MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / workspaceRootOf

Function workspaceRootOf

src/resolution/workspace-packages.ts:752–758  ·  view source on GitHub ↗

The nested root (see WorkspacePackages.nestedRoots) `file` is under, the deepest; `''` for the project's own.

(file: string, roots: string[])

Source from the content-addressed store, hash-verified

750
751/** The nested root (see WorkspacePackages.nestedRoots) `file` is under, the deepest; `''` for the project's own. */
752function workspaceRootOf(file: string, roots: string[]): string {
753 let root = '';
754 for (const dir of roots) {
755 if (dir.length > root.length && file.startsWith(dir + '/')) root = dir;
756 }
757 return root;
758}
759
760/** Whether `target`, a project path, lies outside the nested root `file` is under, if it is under one. */
761export function leavesWorkspaceRoot(file: string, target: string, ws: WorkspacePackages | null | undefined): boolean {

Callers 1

leavesWorkspaceRootFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected