用法
ensureTrailingSlash 函数用于确保 URL 以斜杠结尾。
import { ensureTrailingSlash } from '@movk/core'
ensureTrailingSlash('https://example.com') // 'https://example.com/'
ensureTrailingSlash('https://example.com/path') // 'https://example.com/path/'
ensureTrailingSlash('https://example.com/') // 'https://example.com/'
API
ensureTrailingSlash(url)
确保 URL 以斜杠结尾。
参数
url
string required
URL 字符串。
返回值
返回值
string
带尾部斜杠的 URL。
Changelog
No recent changes