Includes:
Everything after the hash (#), including the hash itself. If none exist, this will be an empty string.
Includes:
Domain, subdomains, and TLD (.com).
The full url string.
Includes:
Infrequently used password part of a url.
Everything between origin and search/hash with a leading slash. If none exist, this will be
simply '/'
.
Each path part of the pathname.
Port part of the URL. If none exist, this will be an empty string.
Http, https, wss, etc.
Everything after a ?, excluding the hash, including ?
, as a string. If none exist, this
will be an empty string.
An object representation of the parameters contained within the search string. If none exist, it will be an empty object.
Infrequently used username part of a url.
import {parseUrl} from 'url-vir';
let result = parseUrl('https://example.com:123/hello/there');
// output
result = {
protocol: 'https',
username: '',
password: '',
host: 'example.com:123',
hostname: 'example.com',
port: '123',
origin: 'https://example.com:123',
pathname: '/hello/there',
paths: [
'hello',
'there',
],
search: '',
searchParams: {},
hash: '',
fullPath: '/hello/there',
href: 'https://example.com:123/hello/there',
};
Converts a string or
URL
instance into UrlParts.