uri-parse-lib
v2.5.0
Published
Small library for parsing URL.
Downloads
106
Readme
uri-parse-lib
Small library for parse URI(URL) for web/node
Try it
What the difference with new URL(url)?
- It is deeply parse search params like a object(check examples)
- Check first one!(it is main once)
Install
npm install uri-parse-lib
Usage
import { parseURI } from "uri-parse-lib"`
parseURI("http://user:[email protected]:8080/directory/file.ext?query[nan][0][nan]=1&query[nan][1][sed]=4&sed[tatat][rqwr]=5&query[nan][2][sed]=4#anchor");`
{
"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"
}