MCPcopy Index your code
hub / github.com/massCodeIO/massCode / stripRootDir

Function stripRootDir

src/main/http/import/opencollection.ts:66–76  ·  view source on GitHub ↗
(path: string, rootDir: string)

Source from the content-addressed store, hash-verified

64}
65
66function stripRootDir(path: string, rootDir: string): string {
67 const normalized = normalizePath(path)
68 const normalizedRootDir = normalizePath(rootDir)
69 if (!normalizedRootDir)
70 return normalized
71 if (normalized === normalizedRootDir)
72 return ''
73 if (normalized.startsWith(`${normalizedRootDir}/`))
74 return normalized.slice(normalizedRootDir.length + 1)
75 return normalized
76}
77
78function isInsideRoot(path: string, rootDir: string): boolean {
79 const normalized = normalizePath(path)

Callers 1

parseOpenCollectionFilesFunction · 0.85

Calls 1

normalizePathFunction · 0.85

Tested by

no test coverage detected