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

Function referencesFrom

__tests__/react-own-declaration.test.ts:209–216  ·  view source on GitHub ↗

Where a node's references named `name` go, `kind:name@file`, and which strategy resolved each.

(g: CodeGraph, from: Node, name: string, edgeKind = 'references')

Source from the content-addressed store, hash-verified

207
208/** Where a node's references named `name` go, `kind:name@file`, and which strategy resolved each. */
209function referencesFrom(g: CodeGraph, from: Node, name: string, edgeKind = 'references') {
210 return g.getOutgoingEdges(from.id)
211 .filter((e) => e.kind === edgeKind && e.metadata?.refName === name)
212 .map((e) => {
213 const target = g.getNode(e.target)!;
214 return { to: `${target.kind}:${target.name}@${target.filePath}`, resolvedBy: e.metadata?.resolvedBy };
215 });
216}
217
218describe('a name a .tsx file declares itself', () => {
219 it('has the namesake components the cases below need', () => {

Callers 1

Calls 3

mapMethod · 0.80
getNodeMethod · 0.80
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected