用法
getRelativePath 函数用于获取两个 URL 之间的相对路径。
import { getRelativePath } from '@movk/core'
getRelativePath('https://example.com/a/b', 'https://example.com/a/c')
// '../c'
getRelativePath('https://example.com/a', 'https://example.com/a/b/c')
// 'b/c'
API
getRelativePath(from, to)
获取两个 URL 之间的相对路径。
参数
from
string required
起始 URL。
to
string required
目标 URL。
返回值
返回值
string
相对路径。
Changelog
No recent changes