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
- Host: GitHub
- URL: https://github.com/pxyup/uri-parse-lib
- Owner: PxyUp
- License: gpl-3.0
- Created: 2016-12-21T16:03:02.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-02-27T18:45:18.000Z (almost 3 years ago)
- Last Synced: 2025-04-03T15:52:28.732Z (10 months ago)
- Topics: js, parser, url
- Language: TypeScript
- Homepage: https://pxyup.github.io/uri-parse-lib/
- Size: 521 KB
- Stars: 24
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# uri-parse-lib
Small library for parse URI(URL) for web/node
[](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"
}
```