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

Function prefixOf

src/resolution/frameworks/angular-router.ts:648–659  ·  view source on GitHub ↗
(file: string, seen: Set<string> = new Set())

Source from the content-addressed store, hash-verified

646 }
647 const memo = new Map<string, string[]>();
648 const prefixOf = (file: string, seen: Set<string> = new Set()): string[] => {
649 const hit = memo.get(file);
650 if (hit !== undefined) return hit;
651 const mount = loadedBy.get(file);
652 let prefix: string[] = [];
653 if (mount && !seen.has(file)) {
654 seen.add(file);
655 prefix = [...prefixOf(mount.parent, seen), ...resolvedSegments(mount.prefix, mount.parent, context)];
656 }
657 memo.set(file, prefix);
658 return prefix;
659 };
660 const mounts: AngularMounts = { mountFiles, prefixOf: (file) => prefixOf(file) };
661 mountMemo.set(context, { source, mounts });
662 return mounts;

Callers 2

angularMountsFunction · 0.85
postExtractFunction · 0.85

Calls 5

resolvedSegmentsFunction · 0.85
hasMethod · 0.80
getMethod · 0.65
addMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected