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

https://github.com/pxyup/uri-parse-lib

Library for parse URI
https://github.com/pxyup/uri-parse-lib

js parser url

Last synced: 9 months ago
JSON representation

Library for parse URI

Awesome Lists containing this project

README

          

# uri-parse-lib

Small library for parse URI(URL) for web/node

[![NPM](https://nodei.co/npm/uri-parse-lib.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/uri-parse-lib/)

# Try it

[DEMO](https://pxyup.github.io/uri-parse-lib)

# What the difference with new URL(url)?

1. It is deeply parse search params like a object(check examples)
2. Check first one!(it is main once)

# Install

npm install uri-parse-lib

# Usage

```typescript
import { parseURI } from "uri-parse-lib"`

parseURI("http://user:pass@example.com:8080/directory/file.ext?query[nan][0][nan]=1&query[nan][1][sed]=4&sed[tatat][rqwr]=5&query[nan][2][sed]=4#anchor");`
```

```json
{
"hash": "#anchor",
"host": "example.com",
"origin": "http://example.com:8080",
"password": "pass",
"pathname": "/directory/file.ext",
"port": "8080",
"protocol": "http",
"query": {
"query": {
"nan": [
{
"nan": "1"
},
{
"sed": "4"
},
{
"sed": "4"
}
]
},
"sed": {
"tatat": {
"rqwr": "5"
}
}
},
"user": "user"
}
```