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

Function inReferencingFolder

src/resolution/frameworks/component-folder.ts:17–26  ·  view source on GitHub ↗
(
  fromFile: string,
  candidates: readonly T[],
  pathOf: (candidate: T) => string
)

Source from the content-addressed store, hash-verified

15 * order. A file at the project root has no folder to prefer, so it gets none.
16 */
17export function inReferencingFolder<T>(
18 fromFile: string,
19 candidates: readonly T[],
20 pathOf: (candidate: T) => string
21): T[] {
22 const cut = fromFile.lastIndexOf('/');
23 if (cut < 0) return [];
24 const folder = fromFile.slice(0, cut + 1);
25 return candidates.filter((candidate) => pathOf(candidate).startsWith(folder));
26}

Callers 5

resolveComponentFunction · 0.90
resolveComponentFunction · 0.90
resolveComponentFunction · 0.90
resolveComponentFunction · 0.90

Calls 1

pathOfFunction · 0.85

Tested by

no test coverage detected