UNPKG

yahoo-finance2

Version:
32 lines (31 loc) 1.17 kB
"use strict"; // Copyright 2018-2025 the Deno authors. MIT license. // This module is browser compatible. Object.defineProperty(exports, "__esModule", { value: true }); exports.extname = extname; const os_js_1 = require("../../internal/1.0.13/os.js"); const extname_js_1 = require("./posix/extname.js"); const extname_js_2 = require("./windows/extname.js"); /** * Return the extension of the path with leading period ("."). * * @example Usage * ```ts * import { extname } from "@std/path/extname"; * import { assertEquals } from "@std/assert"; * * if (Deno.build.os === "windows") { * assertEquals(extname("C:\\home\\user\\Documents\\image.png"), ".png"); * assertEquals(extname(new URL("file:///C:/home/user/Documents/image.png")), ".png"); * } else { * assertEquals(extname("/home/user/Documents/image.png"), ".png"); * assertEquals(extname(new URL("file:///home/user/Documents/image.png")), ".png"); * } * ``` * * @param path Path with extension. * @returns The file extension. E.g. returns `.ts` for `file.ts`. */ function extname(path) { return os_js_1.isWindows ? (0, extname_js_2.extname)(path) : (0, extname_js_1.extname)(path); }