parse-location

1.0.5 • Public • Published

Parse Location

Creates browser-esque location objects.

Installation

$ yarn add parse-location

Usage

import parseLocation from 'parse-location'
 
const location = parseLocation('http://localhost:3000/foo?bar=bar#baz')
// {
//   host: 'localhost'
//   hostname: 'localhost:3000'
//   href: 'http://localhost:3000/foo?bar=bar#baz'
//   pathname: '/foo',
//   query: { bar: 'bar' },
//   search: '?bar=bar',
//   hash: '#baz',
//   port: '3000',
//   protocol: 'http:',
// }
 

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i parse-location

Weekly Downloads

3

Version

1.0.5

License

MIT

Last publish

Collaborators

  • aribouius