1.0.5 • Published 7 years ago

url-path-info v1.0.5

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

url-path-name

Package that shows path info in an easy to use object

Installation

npm i url-path-info --save-dev

Usage

Just require the url-path-info module.

const pathInfo = require('url-path-info');

pathInfo('https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Mapid?foo=lorem&bar=&baz');

// => Output
{ href: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Mapid?foo=lorem&bar=&baz',
  protocol: 'https:',
  host: 'developer.mozilla.org',
  params: 
   { 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Mapid?foo': 'lorem',
     bar: '',
     baz: '' },
  port: undefined,
  pathname: '/en-US/docs/Web/JavaScript/Reference/Global_Objects/Mapid',
  search: '?foo=lorem&bar=&baz',
  hash: ''

Tests

npm test