UNPKG

@oazmi/build-tools

Version:

general deno build tool scripts which I practically use in all of my typescript repos

20 lines (19 loc) 764 B
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // This module is browser compatible. import { isWindows } from "./_os.js"; import { relative as posixRelative } from "./posix/relative.js"; import { relative as windowsRelative } from "./windows/relative.js"; /** * Return the relative path from `from` to `to` based on current working directory. * * An example in windws, for instance: * from = 'C:\\orandea\\test\\aaa' * to = 'C:\\orandea\\impl\\bbb' * The output of the function should be: '..\\..\\impl\\bbb' * * @param from path in current working directory * @param to path in current working directory */ export function relative(from, to) { return isWindows ? windowsRelative(from, to) : posixRelative(from, to); }