removeTrailingSlash

移除 URL 的尾部斜杠

用法

removeTrailingSlash 函数用于移除 URL 的尾部斜杠。

import { removeTrailingSlash } from '@movk/core'

removeTrailingSlash('https://example.com/') // 'https://example.com'
removeTrailingSlash('https://example.com/path/') // 'https://example.com/path'
removeTrailingSlash('https://example.com') // 'https://example.com'

API

removeTrailingSlash(url)

移除 URL 的尾部斜杠。

参数

url
string required
URL 字符串。

返回值

返回值
string
移除尾部斜杠后的 URL。

Changelog

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

Copyright © 2024 - 2026 YiXuan - MIT License