https://github.com/dylanpiercey/mini-url
📖 Lightweight universal url parser.
https://github.com/dylanpiercey/mini-url
isomorphic mini-url parser universal url-parser
Last synced: 10 months ago
JSON representation
📖 Lightweight universal url parser.
- Host: GitHub
- URL: https://github.com/dylanpiercey/mini-url
- Owner: DylanPiercey
- Created: 2017-03-06T03:45:41.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-22T03:16:34.000Z (over 8 years ago)
- Last Synced: 2025-04-11T04:35:21.776Z (10 months ago)
- Topics: isomorphic, mini-url, parser, universal, url-parser
- Language: TypeScript
- Homepage:
- Size: 231 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Mini-URL
Light weight, universal, URL parser for node and the browser with built in caching.
# Installation
```console
npm install mini-url
```
# Example
```javascript
import { parse, stringify } from 'mini-url'
// Parse a url into an object.
parse('http://host.com:8080/p/a/t/h?query=string#hash')
/* {
protocol: 'http:',
host: 'host.com:8080',
port: '8080',
hostname: 'host.com',
hash: '#hash',
search: '?query=string',
pathname: '/p/a/t/h',
href: 'http://host.com:8080/p/a/t/h?query=string#hash'
} */
// Stringify an object into a url string.
stringify({
protocol: 'http:',
host: 'host.com:8080',
hash: '#hash',
search: '?query=string',
pathname: '/p/a/t/h'
})
/* http://host.com:8080/p/a/t/h?query=string#hash */
```
### Contributions
* Use `npm test` to build and run tests.
Please feel free to create a PR!