1.0.2 • Published 7 years ago

url-lite v1.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

url-lite

Lightweight node url regex based drop in replacement for browsers

Inspired by Getting parts of a URL (Regex)

install

npm install url-lite --save

usage

var url = require('url-lite')

var result = url.parse('https://example.com/path?param=value#hash')
console.log(result)
/*
{
  href: 'https://example.com/path?param=value#hash',
  origin: 'https://example.com,
  protocol: 'https:',
  username: undefined,
  password: undefined,
  host: 'example.com',
  hostname: 'example.com',
  port: undefined,
  pathname: '/path',
  search: '?param=value',
  hash: '#hash'
}
*/

var result2 = url.format(result)
console.log(result2)
// 'https://example.com/path?param=value#hash'

license

MIT