Skip to content

[F] isPathAbsolute

function isPathAbsolute(path): boolean;

Determines whether a path starts with an absolute path component (i.e. /, c:/, file://, etc.).

// POSIX
isPathAbsolute("/path/to/file.ext") === true
// DOS
isPathAbsolute("c:/path/to/file.ext") === true
// URL
isPathAbsolute("file:///path/to/file.ext") === true
// Non-absolute
isPathAbsolute("path/to/file.ext") === false
isPathAbsolute("./path/to/file.ext") === false
ParameterType
pathstring

boolean