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

Function decisionOf

src/ui-server/api/steps.ts:659–672  ·  view source on GitHub ↗
(guards: readonly BranchGuard[])

Source from the content-addressed store, hash-verified

657 * share, so it is the innermost that says which way this site went.
658 */
659 const decisionOf = (guards: readonly BranchGuard[]): WireStepDecision | null => {
660 const g = guards[guards.length - 1];
661 if (!g || !g.branch) return null;
662 // A one-sided guard (`if (!product) throw`) is a guard clause, not a
663 // choice with two drawn ways; it keeps its condition on the line.
664 if (g.form === 'guard') return null;
665 return {
666 branch: g.branch,
667 on: guardLabel([{ ...g, negated: false }]),
668 arm: guardLabel([g]),
669 form: g.form === 'case' ? 'switch' : g.form === 'ternary' ? 'ternary' : g.form === 'catch' ? 'try' : 'if',
670 ...(g.negated ? { not: true as const } : {}),
671 };
672 };
673
674 const steps = new Map<string, StepRecord>();
675 const links = new Map<string, WireStepLink>();

Callers 2

effectLinkFunction · 0.85
buildStepsFunction · 0.85

Calls 1

guardLabelFunction · 0.90

Tested by

no test coverage detected