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

Function reachedFrom

__tests__/resolution.test.ts:6502–6510  ·  view source on GitHub ↗
(consumer: string, name: string)

Source from the content-addressed store, hash-verified

6500 // same question as the functions: a type annotation is a reference, not
6501 // a call.
6502 const reachedFrom = (consumer: string, name: string): boolean => {
6503 const target = cg
6504 .searchNodes(name, { limit: 10 })
6505 .find((r) => r.node.name === name && r.node.filePath !== consumer);
6506 expect(target, `no node named ${name}`).toBeDefined();
6507 return cg
6508 .getIncomingEdges(target!.node.id)
6509 .some((e) => cg.getNode(e.source)?.filePath === consumer);
6510 };
6511
6512 expect(reachedFrom('consumer.js', 'widget')).toBe(false);
6513 expect(reachedFrom('consumer.js', 'gadget')).toBe(true);

Callers 1

resolution.test.tsFile · 0.70

Calls 3

getNodeMethod · 0.80
searchNodesMethod · 0.65
getIncomingEdgesMethod · 0.65

Tested by

no test coverage detected