decode-uri-component
A better decodeURIComponent
Why?
- Decodes
+
to a space. - Converts the BOM to a replacement character
�
. - Does not throw with invalid encoded input.
- Decodes as much of the string as possible.
Install
$ npm install --save decode-uri-component
Usage
const decodeUriComponent = ; ;//=> '%' ;//=> '%' ;//=> 'ståle' ;//=> '%ståle%' ;//=> '%{ståle}%' ;//=> '{%ab%|%de%}' ;//=> '\uFFFD\uFFFD' ;//=> '\uFFFD' ;//=> 'µ'
API
decodeUriComponent(encodedURI)
encodedURI
Type: string
An encoded component of a Uniform Resource Identifier.
License
MIT © Sam Verschueren