url-path-info

1.0.5 • Public • Published

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

Dependents (0)

Package Sidebar

Install

npm i url-path-info

Weekly Downloads

0

Version

1.0.5

License

MIT

Last publish

Collaborators

  • ahadb