normalize
function normalize(path: string): string;
A . is dropped, a .. removes the segment before it, repeated separators collapse, and a trailing separator is removed.
The result always starts at the root: normalize("a/b") is "/a/b". Use join when a relative path has to stay relative.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The path to normalise. |
Returns
string — the normalised path.
Examples
Normalising
normalize("a/./b/../c"); // => "/a/c"
normalize("/a/b/../c/"); // => "/a/c"
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.