MCPcopy Create free account
hub / github.com/tiann/hapi / normalizeWorkspaceRoots

Function normalizeWorkspaceRoots

cli/src/api/apiMachine.ts:43–57  ·  view source on GitHub ↗
(paths?: string[])

Source from the content-addressed store, hash-verified

41}
42
43function normalizeWorkspaceRoots(paths?: string[]): string[] | undefined {
44 if (!paths?.length) {
45 return undefined
46 }
47
48 const normalized = Array.from(new Set(paths.map((path) => {
49 try {
50 return realpathSync(path)
51 } catch {
52 return resolvePath(path)
53 }
54 })))
55
56 return normalized.length > 0 ? normalized : undefined
57}
58
59function workspaceRootsEqual(left?: string[], right?: string[]): boolean {
60 const normalizedLeft = left ?? []

Callers 1

constructorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected