Skip to content

Function: normalize()

ts
function normalize(path): string;

Normalize a file system path by removing any unnecessary "." and ".." segments and resolving any directory separators to match the host operating system.

Parameters

ParameterTypeDescription
pathstringThe file system path to be normalized.

Returns

string

The normalized path.

Example

ts
normalize('/users/john/../jane/./docs/') // => '/users/jane/docs/'

Since

1.0.0

Released under the MIT License.