fix
The fix() function cleans a POSIX path by removing a trailing slash and a leading ./ prefix.
WARNING
Works only with POSIX paths (not Windows paths).
Interactive example
Syntax
typescript
function fix(
path: string
): string;Parameters
path: The path to clean.
Return value
The path without a trailing slash and without a leading ./ prefix. If the path is /, the result is an empty string.
See also
resolveRelative- Resolves multiple segments into a single pathisAbsolute- Checks whether a path is absolute
