uri-parse-lib
TypeScript icon, indicating that this package has built-in type declarations

2.5.0 • Public • Published

uri-parse-lib

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

NPM

Try it

DEMO

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

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");`
{
  "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"
}

Package Sidebar

Install

npm i uri-parse-lib

Weekly Downloads

11

Version

2.5.0

License

MIT

Unpacked Size

90.1 kB

Total Files

9

Last publish

Collaborators

  • pxyup
  • beget