njs
njs copied to clipboard
URL native object.
At least run-time support of #118 is required to do this properly:
> var u = new URL('text.txt', 'file:///')
undefined
> u
URL {
href: 'file:///text.txt',
origin: 'null',
protocol: 'file:',
username: '',
password: '',
host: '',
hostname: '',
port: '',
pathname: '/text.txt',
search: '',
searchParams: URLSearchParams {},
hash: '' }
> Object.getOwnPropertyNames(u)
[]
> Object.getOwnPropertyNames(Object.getPrototypeOf(u))
[ 'constructor',
'toString',
'href',
'origin',
'protocol',
'username',
'password',
'host',
'hostname',
'port',
'pathname',
'search',
'searchParams',
'hash',
'toJSON' ]
> Object.getOwnPropertyDescriptor(Object.getPrototypeOf(u), 'href')
{ get: [Function: get],
set: [Function: set],
enumerable: true,
configurable: true }