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

Function values

__tests__/member-value-module-function.test.ts:199–207  ·  view source on GitHub ↗

* What the function or method `name` refers to as a value: "target as * written", sorted. A call is not among them.

(cg: CodeGraph | undefined, name: string)

Source from the content-addressed store, hash-verified

197 * written", sorted. A call is not among them.
198 */
199 function values(cg: CodeGraph | undefined, name: string): string[] {
200 const from = [...cg!.getNodesByKind('function'), ...cg!.getNodesByKind('method')].find((n) => n.name === name);
201 expect(from, name).toBeDefined();
202 return cg!
203 .getOutgoingEdges(from!.id)
204 .filter((e) => e.kind === 'references')
205 .map((e) => `${cg!.getNode(e.target)!.qualifiedName} as ${String(e.metadata?.refName ?? '')}`)
206 .sort();
207 }
208
209 /** The functions `name` calls. */
210 function calls(cg: CodeGraph | undefined, name: string): string[] {

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesByKindMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected