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

Function pathFrom

src/ui-server/api/screens.ts:636–652  ·  view source on GitHub ↗

The chain from `start` down to the holder, following `prev` links.

(
  start: string,
  parent: Map<string, { prev: string | null; edge: Edge | null }>,
  nodes: Map<string, Node>
)

Source from the content-addressed store, hash-verified

634
635/** The chain from `start` down to the holder, following `prev` links. */
636function pathFrom(
637 start: string,
638 parent: Map<string, { prev: string | null; edge: Edge | null }>,
639 nodes: Map<string, Node>
640): Array<{ node: Node; edge: Edge | null }> {
641 const out: Array<{ node: Node; edge: Edge | null }> = [];
642 let id: string | null = start;
643 let edgeInto: Edge | null = null;
644 while (id !== null) {
645 const node = nodes.get(id)!;
646 out.push({ node, edge: edgeInto });
647 const step: { prev: string | null; edge: Edge | null } = parent.get(id)!;
648 edgeInto = step.edge;
649 id = step.prev;
650 }
651 return out;
652}
653
654// =============================================================================
655// Conditions

Callers 1

attributeFunction · 0.85

Calls 2

pushMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected