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

Function decisionOf

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

Source from the content-addressed store, hash-verified

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