Skip to main content

Home > @rushstack/node-core-library > Path > isDownwardRelative

Path.isDownwardRelative() method

Returns true if the specified path is a relative path and does not use .. to walk upwards.

Signature:
static isDownwardRelative(inputPath: string): boolean;

Parameters

ParameterTypeDescription
inputPathstring
Returns:

boolean

Example

// These evaluate to true
isDownwardRelative('folder');
isDownwardRelative('file');
isDownwardRelative('folder/');
isDownwardRelative('./folder/');
isDownwardRelative('./folder/file');

// These evaluate to false
isDownwardRelative('../folder');
isDownwardRelative('folder/../file');
isDownwardRelative('/folder/file');