fast-decode-uri-component
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/fast-decode-uri-component package

1.0.1 • Public • Published

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.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.14,746,456latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.14,746,456
1.0.01,160

Package Sidebar

Install

npm i fast-decode-uri-component

Weekly Downloads

4,747,616

Version

1.0.1

License

MIT

Unpacked Size

9.23 kB

Total Files

7

Last publish

Collaborators

  • delvedor