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

Function callers

__tests__/js-resolution-work.test.ts:51–55  ·  view source on GitHub ↗
(graph: CodeGraph, file: string, name: string)

Source from the content-addressed store, hash-verified

49 .filter(([stripped, as]) => as === lang && stripped.length > 0 && text.startsWith(stripped)).length;
50
51 const callers = (graph: CodeGraph, file: string, name: string) => {
52 const target = graph.getNodesByName(name).find((n) => n.filePath === file && n.kind === 'function')!;
53 return [...new Set(graph.getIncomingEdges(target.id).filter((e) => e.kind === 'calls')
54 .map((e) => graph.getNode(e.source)?.name))];
55 };
56
57 it('reads a file with destructuring once, not once per call', async () => {
58 const CALLS = 40;

Callers 1

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesByNameMethod · 0.65
getIncomingEdgesMethod · 0.65

Tested by

no test coverage detected