safeDecodeURIComponent
Decode a URI component safely, returning the original string instead of throwing when the input contains malformed escape sequences.
Usage
safeDecodeURIComponent decodes a URI component safely — returning the original string on failure instead of throwing.
import { safeDecodeURIComponent } from '@movk/core'
safeDecodeURIComponent('%E4%B8%AD%E6%96%87') // '中文'
safeDecodeURIComponent('hello%20world') // 'hello world'
safeDecodeURIComponent('%invalid%') // '%invalid%'
API
safeDecodeURIComponent(str)
Decode a URI component (safe version).
Parameters
str
string required
The string to decode.
Returns
returns
string
The decoded string.
Changelog
No recent changes