mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2024-11-13 07:11:06 +07:00
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
/**
|
|
* Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths.
|
|
*
|
|
* For example, on Linux/macOS:
|
|
* - `/ => /`
|
|
* - `/hello => /`
|
|
*
|
|
* For example, on Windows:
|
|
* - `C:\ => C:\`
|
|
* - `C:\hello => C:\`
|
|
* - `C: => C:`
|
|
* - `C:hello => C:`
|
|
* - `\ => \`
|
|
* - `\hello => \`
|
|
* - `\\hello => \\hello`
|
|
* - `\\hello\world => \\hello\world`
|
|
*/
|
|
export declare function dirname(p: string): string;
|
|
/**
|
|
* Roots the path if not already rooted. On Windows, relative roots like `\`
|
|
* or `C:` are expanded based on the current working directory.
|
|
*/
|
|
export declare function ensureAbsoluteRoot(root: string, itemPath: string): string;
|
|
/**
|
|
* On Linux/macOS, true if path starts with `/`. On Windows, true for paths like:
|
|
* `\\hello\share` and `C:\hello` (and using alternate separator).
|
|
*/
|
|
export declare function hasAbsoluteRoot(itemPath: string): boolean;
|
|
/**
|
|
* On Linux/macOS, true if path starts with `/`. On Windows, true for paths like:
|
|
* `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator).
|
|
*/
|
|
export declare function hasRoot(itemPath: string): boolean;
|
|
/**
|
|
* Removes redundant slashes and converts `/` to `\` on Windows
|
|
*/
|
|
export declare function normalizeSeparators(p: string): string;
|
|
/**
|
|
* Normalizes the path separators and trims the trailing separator (when safe).
|
|
* For example, `/foo/ => /foo` but `/ => /`
|
|
*/
|
|
export declare function safeTrimTrailingSeparator(p: string): string;
|