💥 [ESM] The hyperlink constuctor according to rfc1738, rfc1808, rfc2396, rfc3986 and whatwg. Works with Browser and Node.js
import { hyperlink } from '@awesomeorganization/hyperlink'
// The following examples creates the same link
// http://user:[email protected]:8080/blah?blah=blah#blah
hyperlink({
auth: 'user:pass',
hash: '#blah',
host: 'example.com:8080',
path: '/blah?blah=blah',
protocol: 'http:',
})
hyperlink({
hash: '#blah',
hostname: 'example.com',
password: 'pass',
pathname: '/blah',
port: '8080',
protocol: 'http:',
search: '?blah=blah',
username: 'user',
})
hyperlink({
hash: '#blah',
hostname: 'example.com',
password: 'pass',
pathname: '/blah',
port: '8080',
protocol: 'http:',
query: 'blah=blah',
username: 'user',
})