isAbsolute

import { isAbsolute } from "jsr:@ende/path";

function

function isAbsolute(path: string): boolean

Verifies whether provided path is absolute.

path: string

Path to be verified as absolute.

Returns

true if path is absolute, false otherwise

Example: Usage

import { isAbsolute } from "@ende/path/is-absolute";
import { assert, assertFalse } from "@ende/assert";

if (Ende.build.os === "windows") {
  assert(isAbsolute("C:\\home\\foo"));
  assertFalse(isAbsolute("home\\foo"));
} else {
  assert(isAbsolute("/home/foo"));
  assertFalse(isAbsolute("home/foo"));
}

Source