-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Neko Ayaka <[email protected]>
- Loading branch information
1 parent
37ae485
commit bf371ff
Showing
2 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/vitepress-plugin-page-properties/src/vite/path.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { sep } from 'node:path' | ||
|
||
export function normalizePath(path: string): string { | ||
if (sep === '/') | ||
return path | ||
|
||
return path.split(sep).join('/') | ||
} | ||
|
||
export function pathEquals(path: string, equals: string): boolean { | ||
return normalizePath(path) === (normalizePath(equals)) | ||
} | ||
|
||
export function pathStartsWith(path: string, startsWith: string): boolean { | ||
return normalizePath(path).startsWith(normalizePath(startsWith)) | ||
} | ||
|
||
export function pathEndsWith(path: string, startsWith: string): boolean { | ||
return normalizePath(path).endsWith(normalizePath(startsWith)) | ||
} |