Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A fast percent decoding method like decodeURIComponent without throwing errors.

import deuri from 'deuri';

deuri('hello%20world'); // 'hello world'
deuri('%C3%28'); // '�('

Invalid sequences are replaced with U+FFFD character, which matches node:querystring unescape() method behavior.

Performance

deuri is ~1.5x faster than native decodeURIComponent and 2x faster than fast-decode-uri-component at decoding inputs with valid sequences.

For inputs with invalid sequences, deuri is ~1.1x faster than fast-decode-uri-component and ~70x faster than native decodeURIComponent (as it throws).

Run the benchmarks in bench directory on Github if you want to verify the result yourself.

Credits

The algorithm was tuned from fast-decode-uri-component to improve performance and support replacing invalid sequences.

About

A fast percent encoding method

Resources

Stars

8 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages