UNPKG

@stryke/path

Version:

A package containing various utilities that expand the functionality of NodeJs's built-in `path` module

33 lines (32 loc) 1.33 kB
export declare function normalizeWindowsPath(input?: string): string; /** * Corrects/normalized a file path. * * @param path - The path to correct. * @returns The corrected path. */ export declare function correctPath(path?: string): string; /** * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root. * * @param path - The path to normalize. * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory. * @returns the normalize path string. */ export declare function normalizeString(path: string, allowAboveRoot: boolean): string; /** * Converts a given path to an absolute path based on the current working directory. * * @param path - The path to convert to an absolute path. * @param cwd - The current working directory to use as the base path if the path is not absolute. * @returns The absolute path. */ export declare function toAbsolutePath(path: string, cwd?: string): string; /** * Converts a given path to a relative path based on the current working directory. * * @param path - The path to convert to a relative path. * @param cwd - The current working directory to use as the base path if the path is not absolute. * @returns The relative path. */ export declare function toRelativePath(path: string, cwd?: string): string;