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 = console // 'test'console // '%'console // '/test/hel/lo' console // nullconsole // nullconsole // 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.