Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uri-js-replace

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uri-js-replace

Replacement for abandoned library URI.js (uri-js)

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
751K
increased by5.38%
Maintainers
0
Weekly downloads
 
Created
Source

URI parsing/validating/resolving library

Replacement for abandoned library uri-js aka "URI.js"

NPM

  • Based on Node.js and browser URL api
  • 99% compatible with original URI.js library
  • Solves "The punycode module is deprecated" warning in Node
  • Tested with libraries: ESLint, Webpack, Ajv

Usage

NPM

Add to your package.json

{
  "overrides": {
    "uri-js": "npm:uri-js-replace"
  }
}

and run

npm update

Yarn

{
  "resolutions": {
    "uri-js": "npm:uri-js-replace"
  }
}

Library usage examples

Parsing

import * as URI from "uri-js";

URI.parse("uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body");
//returns:
//{
//  scheme : "uri",
//  userinfo : "user:pass",
//  host : "example.com",
//  port : 123,
//  path : "/one/two.three",
//  query : "q1=a1&q2=a2",
//  fragment : "body"
//}

Serializing

URI.serialize({scheme : "http", host : "example.com", fragment : "footer"}) === "http://example.com/#footer"

Normalizing

URI.normalize("URI://www.example.org/red%09ros\xE9#red") === "uri://www.example.org/red%09ros%C3%A9#red"

Tests

All tests copied from original repository

vitest

Generating d.ts files

npm i -g typescript
tsc

NPM

https://www.npmjs.com/package/uri-js-replace

FAQs

Package last updated on 08 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc