yahoo-finance2
Version:
JS API for Yahoo Finance
34 lines (33 loc) • 1.19 kB
JavaScript
;
// Copyright 2018-2025 the Deno authors. MIT license.
// This module is browser compatible.
Object.defineProperty(exports, "__esModule", { value: true });
exports.relative = relative;
const os_js_1 = require("../../internal/1.0.13/os.js");
const relative_js_1 = require("./posix/relative.js");
const relative_js_2 = require("./windows/relative.js");
/**
* Return the relative path from `from` to `to` based on current working
* directory.
*
* @example Usage
* ```ts
* 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");
* }
* ```
*
* @param from Path in current working directory.
* @param to Path in current working directory.
* @returns The relative path from `from` to `to`.
*/
function relative(from, to) {
return os_js_1.isWindows ? (0, relative_js_2.relative)(from, to) : (0, relative_js_1.relative)(from, to);
}