An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          





Mini-URL



API Stability



TypeScript



Styled with prettier



Build status



Test Coverage



NPM Version



Downloads



Browser Bundle Size

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!