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

Function adjacent

__tests__/graph.test.ts:678–682  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

676 const site = (e: Edge) => `${e.source}|${e.target}|${e.kind}|${e.line ?? -1}|${e.column ?? -1}`;
677 const of = (list: Edge[]) => (opts.edgeKinds.length > 0 ? list.filter((e) => opts.edgeKinds.includes(e.kind)) : list);
678 const adjacent = (id: string): Edge[] => {
679 const out = of(edges.filter((e) => e.source === id));
680 const into = of(edges.filter((e) => e.target === id));
681 return opts.direction === 'outgoing' ? out : opts.direction === 'incoming' ? into : [...out, ...into];
682 };
683 const kept = new Map<string, Node>([[startId, byId.get(startId)!]]);
684 const keptEdges: Edge[] = [];
685 const visited = new Set<string>();

Callers 1

fetchAllFirstFunction · 0.85

Calls 1

ofFunction · 0.70

Tested by

no test coverage detected