yahoo-finance2
Version:
JS API for Yahoo Finance
31 lines (30 loc) • 1.11 kB
JavaScript
;
// Copyright 2018-2025 the Deno authors. MIT license.
// This module is browser compatible.
Object.defineProperty(exports, "__esModule", { value: true });
exports.format = format;
const os_js_1 = require("../../internal/1.0.13/os.js");
const format_js_1 = require("./posix/format.js");
const format_js_2 = require("./windows/format.js");
/**
* Generate a path from a {@linkcode ParsedPath} object. It does the
* opposite of {@linkcode https://jsr.io/@std/path/doc/~/parse | parse()}.
*
* @example Usage
* ```ts
* import { format } from "@std/path/format";
* import { assertEquals } from "@std/assert";
*
* if (Deno.build.os === "windows") {
* assertEquals(format({ dir: "C:\\path\\to", base: "script.ts" }), "C:\\path\\to\\script.ts");
* } else {
* assertEquals(format({ dir: "/path/to/dir", base: "script.ts" }), "/path/to/dir/script.ts");
* }
* ```
*
* @param pathObject Object with path components.
* @returns The formatted path.
*/
function format(pathObject) {
return os_js_1.isWindows ? (0, format_js_2.format)(pathObject) : (0, format_js_1.format)(pathObject);
}