Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

path.ts

22 lines568 Bytes

1export function isWindowsDrivePath(value: string): boolean {
2 return /^[a-zA-Z]:([/\\]|$)/.test(value);
3}
4​
5export function isUncPath(value: string): boolean {
6 return value.startsWith("\\\\");
7}
8​
9export function isWindowsAbsolutePath(value: string): boolean {
10 return isUncPath(value) || isWindowsDrivePath(value);
12​
13export function isExplicitRelativePath(value: string): boolean {
14 return (
15 value === "." ||
16 value === ".." ||
17 value.startsWith("./") ||
18 value.startsWith("../") ||
19 value.startsWith(".\\") ||
20 value.startsWith("..\\")
21 );