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

Function targets

__tests__/go-nested-module.test.ts:80–89  ·  view source on GitHub ↗

`file::qualifiedName` of every `kind` target of the symbol `name` in `file`.

(cg: CodeGraph, file: string, name: string, kind = 'calls')

Source from the content-addressed store, hash-verified

78
79/** `file::qualifiedName` of every `kind` target of the symbol `name` in `file`. */
80function targets(cg: CodeGraph, file: string, name: string, kind = 'calls'): string[] {
81 const fn = cg.getNodesInFile(file).find((n) => n.name === name);
82 expect(fn, `${name} in ${file}`).toBeDefined();
83 return cg
84 .getOutgoingEdges(fn!.id)
85 .filter((e) => e.kind === kind)
86 .map((e) => cg.getNode(e.target)!)
87 .map((n) => `${n.filePath.replace(/\\/g, '/')}::${n.qualifiedName}`)
88 .sort();
89}
90
91describe('Go module in a subdirectory (#2322)', () => {
92 let cg: CodeGraph;

Callers 1

Calls 4

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

Tested by

no test coverage detected