patha
Version:
File paths library. All you need to work with paths. Tiny drop-in replacement for 'path'. Works in Node, Browser, and Deno.
20 lines (19 loc) • 661 B
text/typescript
/**
* Add a native shell extension to the given name.
*
* @example
*
* ```js
* import { addShExt } from "patha"
*
* addShExt("path/to/file-name") // gives "path/to/file-name.cmd" on Windows and "path/to/file-name.sh" on others
*
* addShExt("path/to/file-name", ".bat") // gives "path/to/file-name.bat" on Windows and "path/to/file-name.sh" on others
* ```
*
* @param name The name you want to add the shell extension to
* @param win_ext `.cmd` on Windows
* @param other_ext `.sh` On others.
* @returns The file path with the shell extension added
*/
export declare function addShExt(name: string, win_ext?: string, other_ext?: string): string;