Function relative
- relative(from, to): string
Parameters
- from: string
Path in current working directory.
- to: string
Path in current working directory.
Returns string
The relative path from
fromtoto.Example: Usage
import { relative } from "@std/path/relative";
import { assertEquals } from "@std/assert";
if (Deno.build.os === "windows") {
const path = relative("C:\\foobar\\test\\aaa", "C:\\foobar\\impl\\bbb");
assertEquals(path, "..\\..\\impl\\bbb");
} else {
const path = relative("/data/foobar/test/aaa", "/data/foobar/impl/bbb");
assertEquals(path, "../../impl/bbb");
}- from: string
Return the relative path from
fromtotobased on current working directory.