UNPKG

patha

Version:

File paths library. All you need to work with paths. Tiny drop-in replacement for 'path'. Works in Node, Browser, and Deno.

21 lines (20 loc) 595 B
/** * Get the name of the given file path. * * By default the file extension is included in the returned name. To remove the extension, set the second parameter to `false`. * * @example * * ```js * import { name } from "patha" * * name("path/to/file.md") // gives "file.md" * * name("path/to/file.md", false) // gives "file" * ``` * * @param path The given file path * @param includeExtension If the name should include the file extension as well * @returns The base name without the extension */ export declare function name(path: string, includeExtension?: boolean): string;