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

Function whenTokens

ui/src/lib/conditions.ts:129–135  ·  view source on GitHub ↗
(when: string)

Source from the content-addressed store, hash-verified

127
128/** A whole `when` as tokens: scenarios joined by OR, each its guards joined by AND. Empty when unconditional. */
129export function whenTokens(when: string): WordToken[] {
130 if (!when) return [];
131 return joinWith(
132 splitTop(when, ' || ').map((scenario) => joinWith(distinct(splitTop(scenario, ' && ')).map(clauseTokens), 'AND')),
133 'OR'
134 );
135}
136
137/** {@link whenTokens} led by WHEN, or `always` when there is nothing to say. */
138export function conditionTokens(when: string): WordToken[] {

Callers 2

conditionTokensFunction · 0.70
whenWordsFunction · 0.70

Calls 4

joinWithFunction · 0.85
distinctFunction · 0.85
mapMethod · 0.80
splitTopFunction · 0.70

Tested by

no test coverage detected