url-path-info
v1.0.5
Published
Package that shows path info in an easy to use object
Downloads
5
Maintainers
Readme
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