1.0.1 • Published 7 years ago

uri-sharp v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

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',
});