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

fast-decode-uri-component

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-decode-uri-component

Fast and safe decodeURIComponent

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.7M
decreased by-0.69%
Maintainers
1
Weekly downloads
 
Created
Source

fast-decode-uri-component

js-standard-style Build Status

Decodes strings encoded by encodeURI and encodeURIComponent, without throwing errors on invalid escapes, instead, it returns null.

Installation

npm install fast-decode-uri-component

Usage

const fastDecode = require('fast-decode-uri-component')

console.log(fastDecode('test')) // 'test'
console.log(fastDecode('%25')) // '%'
console.log(fastDecode('/test/hel%2Flo')) // '/test/hel/lo'

console.log(fastDecode('/test/hel%"Flo')) // null
console.log(fastDecode('%7B%ab%7C%de%7D')) // null
console.log(fastDecode('%ab')) // null

Benchmarks

You can find the benchmark file here.

# fast-decode-uri-component
ok ~539 ms (0 s + 539114308 ns)

# decodeURIComponent
ok ~6.06 s (6 s + 62305153 ns)

Acknowledgements

This project has been forked from jridgewell/safe-decode-uri-component because I wanted to change the behaviour of the library on invalid inputs, plus change some internals.
All the credits before the commit 53000fe goes to the jridgewell/safe-decode-uri-component project contributors.
Since the commit 9673ab7 the project will be maintained by @delvedor.

License

Licensed under MIT.

Keywords

FAQs

Package last updated on 15 Mar 2019

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