omnibox
v1.0.0
Published
Fast url parsing with a tiny footprint
Readme
omnibox
Fast url parsing with a tiny footprint and extensive browser support
This module is mostly a re-implementation of fast-url-parser designed to make the footprint smaller and the browser support broader.
install
npm install omnibox --savebower install omnibox --saveassumptions
Use omnibox only if you don't need any of the features shown below.
- Support for malformed input
- Support for a protocol other than
http,https - Basic authentication support
http://user:[email protected] - IDNA support (special characters in host)
options- Anything that's provided by the
.parsemethod
If you need any of those features, use the more comprehensive fast-url-parser instead. Note that browser support is smaller because they rely on Uint8Array, and their footprint is also larger.
omnibox.parse(url)
Parses a URL string and returns its different components. The query string is parsed by default. There's no option that prevents this behavior.
Example
Result for omnibox.parse('https://stompflow.com/foo?bar=23&baz=abc#hash-parts').
{ protocol: 'https',
hostname: 'stompflow.com',
host: 'stompflow.com',
port: undefined,
pathname: '/foo',
path: '/foo?bar=23&baz=abc',
search: '?bar=23&baz=abc',
hash: '#hash-parts',
query: { bar: '23', baz: 'abc' } }License
MIT
