@lonu/stc
Version:
A tool for converting OpenApi/Swagger/Apifox into code.
30 lines • 1.16 kB
TypeScript
/**
* 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");
* assertEquals(dirname(new URL("file:///home/user/Documents/image.png")), "/home/user/Documents");
* ```
*
* @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 | URL): string;
//# sourceMappingURL=dirname.d.ts.map