eu

extra-url

A url wrapper that offers more options than the builtin one.

Showing:

Popularity

Downloads/wk

0

Maintenance

No Maintenance Data Available

Package

Dependencies

0

Size (min+gzip)

1.9KB

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Deprecated!
Use the new builtin URL module instead!

Readme

extra-url

An extension of the builtin url module.

url.parse('http://user:pass@host.com:8080/p/a/t/h/file.txt?query=string%21#hash', true /* fix? -> fix half-urls */);

/*STANDARD:
┌─────────────────────────────────────────────────────────────────────────────┐
│                                    href                                     │
├──────────┬┬───────────┬─────────────────┬───────────────────────────┬───────┤
│ protocol ││   auth    │      host       │           path            │ hash  │
│          ││           ├──────────┬──────┼──────────┬────────────────┤       │
│          ││           │ hostname │ port │ pathname │     search     │       │
│          ││           │          │      │          ├─┬──────────────┤       │
│          ││           │          │      │          │ │    query     │       │
"  http:   // user:pass @ host.com : 8080   /p/a/t/h  ?  query=string   #hash "
│          ││           │          │      │          │ │              │       │
└──────────┴┴───────────┴──────────┴──────┴──────────┴─┴──────────────┴───────┘
*/ //EXTENDED:
Url {
  hrefraw: 'http://user:pass@host.com:8080/p/a/t/h/file.txt?query=string%21#hash',
  href: 'http://user:pass@host.com:8080/p/a/t/h/file.txt?query=string!#hash',
  protocolfull: 'http://',
  protocolraw: 'http:',
  protocol: 'http',
  auth: 'user:pass',
  autharr: [ 'user', 'pass' ],
  hostfull: 'user:pass@host.com:8080',
  authhost: 'user:pass@host.com',
  host: 'host.com:8080',
  hostname: 'host.com',
  port: '8080',
  pathraw: '/p/a/t/h/file.txt?query=string%21',
  path: '/p/a/t/h/file.txt?query=string!',
  pathnameraw: '/p/a/t/h/file.txt',
  pathname: '/p/a/t/h/file.txt',
  searchraw: '?query=string%21',
  search: '?query=string!',
  querystringraw: 'query=string%21',
  querystring: 'query=string!',
  queryarrrawdeep: [ [ 'query', 'string%21' ] ],
  queryarrraw: [ 'query=string%21' ],
  queryarrdeep: [ [ 'query', 'string!' ] ],
  queryarr: [ 'query=string!' ],
  queryraw: { query: 'string!' },
  query: { query: 'string!' },
  directoryraw: '/p/a/t/h',
  directory: '/p/a/t/h',
  filepureraw: '/file.txt',
  filepure: '/file.txt',
  fileraw: 'file.txt',
  file: 'file.txt',
  filenameraw: 'file',
  filename: 'file',
  extensionfull: '.txt',
  extension: 'txt',
  hashraw: '#hash',
  hash: '#hash',
  hashnameraw: 'hash',
  hashname: 'hash',
  pathobject: 
   { root: '/',
     dir: '/p/a/t/h',
     base: 'file.txt',
     ext: '.txt',
     name: 'file' },
  toString: [Function: toString],
  slashes: true,
  _revoke: [Function: revoke] }
*/

By editing one of the properties of the Url object returned by url.parse, the whole object gets rebuilt to adjust on the change!

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100