uri-sharp
v1.0.1
Published
Parse an URI and return an object. Similar to .NET Uri class.
Downloads
3
Readme
uri-sharp
Install
npm i -S uri-sharp
TypeScript definitions included.
Example
import parseUri from 'uri-sharp';
const uriText = 'http://www.codingwise.com/blog/?search=csharp#hash=net&ok=1';
const uri = parseUri(uriText);
assert.deepEqual(uri, {
absolutePath: '/blog/',
absoluteUri: uriText,
authority: 'www.codingwise.com',
hash: {
hash: 'net',
ok: '1',
},
hashString: '#hash=net&ok=1',
host: 'www.codingwise.com',
hostNameType: 'dns',
isDefaultPort: true,
originalString: uriText,
pathAndQuery: '/blog/?search=csharp',
port: 80,
query: {
search: 'csharp',
},
queryString: '?search=csharp',
scheme: 'http',
});