0.2.6 • Published 5 years ago
href-constructor v0.2.6
href-constructor
:boom: ESM Hypertext reference (href) constuctor with WHATWG URL Standard. Works with Browser and Node.js
Example
import { href } from 'href-constructor'
// http://user:pass@example.com:8080/blah?blah=blah#blah
href({
auth: 'user:pass',
hash: '#blah',
host: 'example.com:8080',
path: '/blah?blah=blah',
protocol: 'http:',
})
href({
hash: '#blah',
hostname: 'example.com',
password: 'pass',
pathname: '/blah',
port: '8080',
protocol: 'http:',
search: '?blah=blah',
username: 'user',
})
href({
hash: '#blah',
hostname: 'example.com',
password: 'pass',
pathname: '/blah',
port: '8080',
protocol: 'http:',
query: 'blah=blah',
username: 'user',
})