cleanPath()function

cleanPath(path: AbsolutePath): AbsolutePath
cleanPath(path: string): string
ParamType
pathAbsolutePath
The path to normalise. required
pathstring
required
Return
AbsolutePath
The normalised path, preserving the absolute/relative type of path.
string

Normalise a path.

  • Runs of / and \ collapsed to a single /.
  • . "current-directory" segments dropped (so ./a/ba/b, a/./ba/b, ."").
  • Trailing slashes stripped.
  • The root "/" is preserved as-is.

Examples

cleanPath("/a//b/") // "/a/b"