UNPKG

@oazmi/build-tools

Version:

general deno build tool scripts which I practically use in all of my typescript repos

35 lines 1.21 kB
import type { ParsedPath } from "./_interface.js"; export type { ParsedPath } from "./_interface.js"; /** * Return an object containing the parsed components of the path. * * Use {@linkcode https://jsr.io/@std/path/doc/~/format | format()} to reverse * the result. * * @example Usage * ```ts * import { parse } from "@std/path/parse"; * import { assertEquals } from "@std/assert/assert-equals"; * * if (Deno.build.os === "windows") { * const parsedPathObj = parse("C:\\path\\to\\script.ts"); * assertEquals(parsedPathObj.root, "C:\\"); * assertEquals(parsedPathObj.dir, "C:\\path\\to"); * assertEquals(parsedPathObj.base, "script.ts"); * assertEquals(parsedPathObj.ext, ".ts"); * assertEquals(parsedPathObj.name, "script"); * } else { * const parsedPathObj = parse("/path/to/dir/script.ts"); * parsedPathObj.root; // "/" * parsedPathObj.dir; // "/path/to/dir" * parsedPathObj.base; // "script.ts" * parsedPathObj.ext; // ".ts" * parsedPathObj.name; // "script" * } * ``` * * @param path Path to process * @returns An object with the parsed path components. */ export declare function parse(path: string): ParsedPath; //# sourceMappingURL=parse.d.ts.map