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

Function callsIn

__tests__/js-bare-call-scope.test.ts:32–42  ·  view source on GitHub ↗

Every `calls` edge out of `file`'s nodes, as ` -> @ : `.

(file: string)

Source from the content-addressed store, hash-verified

30
31/** Every `calls` edge out of `file`'s nodes, as `<line> -> <qualifiedName>@<file>:<line>`. */
32function callsIn(file: string): string[] {
33 const out: string[] = [];
34 for (const n of cg!.getNodesInFile(file)) {
35 for (const e of cg!.getOutgoingEdges(n.id)) {
36 if (e.kind !== 'calls') continue;
37 const t = cg!.getNode(e.target)!;
38 out.push(`${e.line} -> ${t.qualifiedName}@${t.filePath}:${t.startLine}`);
39 }
40 }
41 return out.sort((a, b) => parseInt(a, 10) - parseInt(b, 10) || a.localeCompare(b));
42}
43
44afterEach(() => {
45 cg?.close();

Callers 1

Calls 4

getNodeMethod · 0.80
pushMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected