MCPcopy Create free account
hub / github.com/microsoft/typescript-go / PathIsAbsolute

Function PathIsAbsolute

internal/tspath/path.go:66–68  ·  view source on GitHub ↗

Determines whether a path starts with an absolute path component (i.e. `/`, `c:/`, `file://`, etc.). ``` // POSIX PathIsAbsolute("/path/to/file.ext") === true // DOS PathIsAbsolute("c:/path/to/file.ext") === true // URL PathIsAbsolute("file:///path/to/file.ext") === true // Non-absolute Pa

(path string)

Source from the content-addressed store, hash-verified

64// PathIsAbsolute("./path/to/file.ext") === false
65// ```
66func PathIsAbsolute(path string) bool {
67 return GetEncodedRootLength(path) != 0
68}
69
70func HasTrailingDirectorySeparator(path string) bool {
71 return len(path) > 0 && isAnyDirectorySeparator(path[len(path)-1])

Callers 9

handleInitializedMethod · 0.92
PathIsBareSpecifierFunction · 0.92
verifyCompilerOptionsMethod · 0.92
EntriesMethod · 0.92
normalizeAbsolutePathFunction · 0.92
prettyPathForFileErrorFunction · 0.92
TestPathIsAbsoluteFunction · 0.85

Calls 1

GetEncodedRootLengthFunction · 0.85

Tested by 1

TestPathIsAbsoluteFunction · 0.68