// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.// This module is browser compatible. import{CHAR_COLON}from"../_common/constants.ts";import{ assertPath }from"../_common/assert_path.ts";import{ isPathSeparator, isWindowsDeviceRoot }from"./_util.ts"; /** * Verifies whether provided path is absolute * @param path to be verified as absolute */exportfunctionisAbsolute(path:string):boolean{assertPath(path); const len = path.length;if(len ===0)returnfalse; const code = path.charCodeAt(0);if(isPathSeparator(code)){returntrue;}elseif(isWindowsDeviceRoot(code)){// Possible device root if(len >2&& path.charCodeAt(1)===CHAR_COLON){if(isPathSeparator(path.charCodeAt(2)))returntrue;}}returnfalse;}