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

Function calls

__tests__/alias-chain-length.test.ts:37–44  ·  view source on GitHub ↗

What the calls written in `from` (a function, or a file's own top level) reach, by qualified name.

(cg: CodeGraph, from: { file: string; name?: string })

Source from the content-addressed store, hash-verified

35
36/** What the calls written in `from` (a function, or a file's own top level) reach, by qualified name. */
37function calls(cg: CodeGraph, from: { file: string; name?: string }): string[] {
38 const sources = cg.getNodesInFile(from.file).filter((n) => (from.name ? n.name === from.name : n.kind === 'file'));
39 return sources
40 .flatMap((n) => cg.getOutgoingEdges(n.id))
41 .filter((e) => e.kind === 'calls')
42 .map((e) => `${cg.getNode(e.target)!.filePath}::${cg.getNode(e.target)!.qualifiedName}`)
43 .sort();
44}
45
46describe('a very long chain of aliases', () => {
47 it('TypeScript: 20,000 aliases index, and a value typed by either end reaches the class', async () => {

Callers 1

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected