Decodes strings encoded by `encodeURI` and `encodeURIComponent`, without throwing errors on invalid escapes, instead, it returns `null`.
npm install @esmkit/decode-uri-componentDecodes strings encoded by encodeURI and encodeURIComponent, without throwing errors on invalid escapes, instead, it returns null.
``bash`
npm install @esmkit/decode-uri-componentor
yarn add @esmkit/decode-uri-componentor
bun add @esmkit/decode-uri-component
`ts
import { decodeURIComponent } from '@esmkit/decode-uri-component';
console.log(decodeURIComponent('test')) // 'test'
console.log(decodeURIComponent('%25')) // '%'
console.log(decodeURIComponent('/test/hel%2Flo')) // '/test/hel/lo'
console.log(decodeURIComponent('/test/hel%"Flo')) // null
console.log(decodeURIComponent('%7B%ab%7C%de%7D')) // null
console.log(decodeURIComponent('%ab')) // null
``
MIT © BILLGO. See LICENSE for details.