// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

import { assertPath } from "../_common/assert_path.ts";
import { isPosixPathSeparator } from "./_util.ts";

/**
 * Verifies whether provided path is absolute
 * @param path to be verified as absolute
 */
export function isAbsolute(path: string): boolean {
  assertPath(path);
  return path.length > 0 && isPosixPathSeparator(path.charCodeAt(0));
}

// denoCacheMetadata={"headers":{"age":"3654297","server":"cloudflare","x-robots-tag":"noindex","accept-ranges":"bytes","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","x-jsr-backend":"modules","date":"Tue, 28 Jul 2026 12:31:15 GMT","access-control-allow-origin":"*","set-cookie":"__cf_bm=WafhoA_d5PIyr_Z6nwmzA25hS_85HlMbEuOtgUSZtpQ-1785241875.2561247-1.0.1.1-b3ItrfCweN8n5GsL2pyHDYZt0lgqrer2j4e6MVcwWVZAH5eFb4Ps88SPOxlT.b8auag4PTfHIykD9Gd89bt4dP28ngTu3Un40fIxVB9fD7bql3UhlDD_YD.Pu8i1Mvme; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","content-length":"462","vary":"Origin","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=5PfAJzd38kZle2J5dvn4n4A1VfymAsYnsc7K%2F1DuF2%2B4ne5jZfZ2ajJtjZAsZ9JE0EqtDJ0%2BTIShf0NZvOkmynk1Kx7Yku9GwDJXYrwTGPEBxrpggP1lAiU%3D\"}]}","cf-cache-status":"HIT","access-control-expose-headers":"*","cross-origin-resource-policy":"cross-origin","content-type":"text/typescript","cache-control":"public, max-age=31536000, immutable","alt-svc":"h3=\":443\"; ma=86400","cf-ray":"a223e6585c0b7db6-LAX","etag":"\"b505c284a77dc4baecb970bc2328dacf\"","x-content-type-options":"nosniff","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';"},"url":"https://jsr.io/@std/path/0.224.0/posix/is_absolute.ts","time":1785241875}