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

Function join

ui/src/lib/program-model.ts:120–138  ·  view source on GitHub ↗
(from: string, to: string, tail: Tail)

Source from the content-addressed store, hash-verified

118 const forks: OrderFork[] = [];
119
120 const join = (from: string, to: string, tail: Tail): void => {
121 if (from === to) return;
122 const key = `${from} ${to}`;
123 const when = tail.when.filter((w, i) => w && tail.when.indexOf(w) === i).join(' && ');
124 const found = at.get(key);
125 if (found) {
126 // Two ways to the same step: the picture keeps both conditions, the way
127 // a link with several sites does.
128 if (when !== found.when) found.when = !when || !found.when ? '' : `${found.when} || ${when}`;
129 for (const r of tail.runs) if (!found.runs.includes(r)) found.runs.push(r);
130 // Reached as two different arms of one decision: it happens either way,
131 // and the line stops claiming a side.
132 if (found.arm !== tail.arm) delete found.arm;
133 return;
134 }
135 const edge: OrderEdge = { from, to, when, runs: [...tail.runs], ...(tail.arm !== undefined ? { arm: tail.arm } : {}) };
136 at.set(key, edge);
137 edges.push(edge);
138 };
139
140 const flow = (block: WireBlock, incoming: readonly Tail[], runs: readonly string[]): Tail[] => {
141 let tails: Tail[] = [...incoming];

Callers 8

flowFunction · 0.70
orderGraphFunction · 0.70
collectMethod · 0.50
globFunction · 0.50
mainFunction · 0.50
vendor-assets.mjsFile · 0.50
ui-package.test.tsFile · 0.50

Calls 4

pushMethod · 0.80
getMethod · 0.65
joinMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected