safeDecodeURIComponent

解码 URL 组件(安全版本,失败返回原字符串)

用法

safeDecodeURIComponent 函数用于解码 URL 组件(安全版本,失败返回原字符串)。

import { safeDecodeURIComponent } from '@movk/core'

safeDecodeURIComponent('%E4%B8%AD%E6%96%87') // '中文'
safeDecodeURIComponent('hello%20world') // 'hello world'
safeDecodeURIComponent('%invalid%') // '%invalid%'

API

safeDecodeURIComponent(str)

解码 URL 组件(安全版本)。

参数

str
string required
要解码的字符串。

返回值

返回值
string
解码后的字符串。

Changelog

7c832 — refactor!: 重构模块架构,拆分 utils 为专业化模块

Copyright © 2024 - 2026 YiXuan - MIT License