getRelativePath
Compute the relative path between two URLs, returning a path that navigates from the source location to the target location.
Usage
getRelativePath computes the relative path between two URLs.
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)
Get the relative path between two URLs.
Parameters
from
string required
The source URL.
to
string required
The target URL.
Returns
returns
string
The relative path.
Changelog
No recent changes