// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// Copyright the Browserify authors. MIT License.
// Ported from https://github.com/browserify/path-browserify/
// This module is browser compatible.

import {
  CHAR_BACKWARD_SLASH,
  CHAR_FORWARD_SLASH,
  CHAR_LOWERCASE_A,
  CHAR_LOWERCASE_Z,
  CHAR_UPPERCASE_A,
  CHAR_UPPERCASE_Z,
} from "../_common/constants.ts";

export function isPosixPathSeparator(code: number): boolean {
  return code === CHAR_FORWARD_SLASH;
}

export function isPathSeparator(code: number): boolean {
  return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
}

export function isWindowsDeviceRoot(code: number): boolean {
  return (
    (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z) ||
    (code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z)
  );
}

// denoCacheMetadata={"headers":{"x-robots-tag":"noindex","cf-cache-status":"HIT","accept-ranges":"bytes","vary":"Origin","cross-origin-resource-policy":"cross-origin","cache-control":"public, max-age=31536000, immutable","etag":"\"77e408e05b02b82b6c91e057d35ac7f4\"","server":"cloudflare","set-cookie":"__cf_bm=5KHd3ZfzIsI2F4xGoJerfJqfEXSzFGTkAwHZWWYG9Oo-1785241875.3783743-1.0.1.1-cGfAruJp47nBJriVic7UJ8g.NB71d_LhOec.R2R2_KIsXDvH27NwyUlDs6_wdSZUKb0BiuHG9vRon227r9X3Imu0Z5tkpsnumLiDofKGdys9WaD0aCGJx1.heMJ0GM31; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","content-length":"828","age":"38659","alt-svc":"h3=\":443\"; ma=86400","cf-ray":"a223e6590e6e7db6-LAX","x-jsr-backend":"modules","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=uzyO0Kyi3Jsp2jTcEcItTFQXe97s3pfiT2xsdEW7HwW3WLEAMGafsL7Vpclu0mufpNASU1h%2Bf9Y1%2B%2FJpRt1hbtsgh0AYOx%2FO%2BbAgxwWHYCqAVbfPf%2F8kdag%3D\"}]}","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","access-control-expose-headers":"*","content-type":"text/typescript","x-content-type-options":"nosniff","date":"Tue, 28 Jul 2026 12:31:15 GMT","access-control-allow-origin":"*","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/1.0.0-rc.2/windows/_util.ts","time":1785241875}