用法
normalizeUrl 函数用于规范化 URL 路径(移除多余斜杠、处理 . 和 ..)。
import { normalizeUrl } from '@movk/core'
normalizeUrl('https://example.com//api///users/')
// 'https://example.com/api/users/'
normalizeUrl('https://example.com/api/../users')
// 'https://example.com/users'
normalizeUrl('/api/./users/../posts')
// '/api/posts'
API
normalizeUrl(url)
规范化 URL 路径。
参数
url
string required
URL 字符串。
返回值
返回值
string
规范化后的 URL。
Changelog
No recent changes