patha
Version:
File paths library. All you need to work with paths. Tiny drop-in replacement for 'path'. Works in Node, Browser, and Deno.
18 lines (17 loc) • 458 B
text/typescript
/**
* Normalizes the path and removes the trailing slashes.
*
* @example
*
* ```js
* import { normalize, normalizeTrim } from "patha"
*
* normalizeTrim("/foo/bar//baz/asdf/hello/../") // gives "/foo/bar/baz/asdf"
*
* normalize("/foo/bar//baz/asdf/hello/../") // gives "/foo/bar/baz/asdf/"
* ```
*
* @param path The given file path
* @returns The normalized and trimmed file path
*/
export declare function normalizeTrim(path: string): string;