UNPKG

abi.js

Version:

[![typescript-icon]][typescript-link] [![license-icon]][license-link] [![status-icon]][status-link] [![ci-icon]][ci-link] [![twitter-icon]][twitter-link]

29 lines (28 loc) 1.02 kB
/** * Return the directory path of a `path`. * * @example Usage * ```ts * import { dirname } from "@std/path/posix/dirname"; * import { assertEquals } from "@std/assert"; * * assertEquals(dirname("/home/user/Documents/"), "/home/user"); * assertEquals(dirname("/home/user/Documents/image.png"), "/home/user/Documents"); * assertEquals(dirname("https://deno.land/std/path/mod.ts"), "https://deno.land/std/path"); * ``` * * @example Working with URLs * * ```ts * import { dirname } from "@std/path/posix/dirname"; * import { assertEquals } from "@std/assert"; * * assertEquals(dirname("https://deno.land/std/path/mod.ts"), "https://deno.land/std/path"); * assertEquals(dirname("https://deno.land/std/path/mod.ts?a=b"), "https://deno.land/std/path"); * assertEquals(dirname("https://deno.land/std/path/mod.ts#header"), "https://deno.land/std/path"); * ``` * * @param path The path to get the directory from. * @returns The directory path. */ export declare function dirname(path: string): string;