Buckets:
32.1 GB
673,093 files
Updated 5 months ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| .travis.yml | 132 Bytes xet | 825750d1 | |
| LICENSE | 1.17 kB xet | 9d933901 | |
| README.md | 1.94 kB xet | c8b08c5a | |
| bench.js | 941 Bytes xet | 7417a7fb | |
| index.js | 3.22 kB xet | ab36075a | |
| package.json | 818 Bytes xet | 6c4e91ab | |
| test.js | 1.01 kB xet | dac95414 |
fast-decode-uri-component
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.
- Total size
- 32.1 GB
- Files
- 673,093
- Last updated
- Mar 19
- Pre-warmed CDN
- US EU US EU