Kaizen
Browse modulesRulesrules/sharedFunctions

Function: evaluateCondition()

function evaluateCondition<TContext>(
   condition: Condition, 
   context: TContext, 
   customConditions?: Map<string, CustomConditionDef<unknown, TContext>>
): ConditionResult;

Defined in: shared/rules/engine.ts:190

Evaluate a single condition against the context. Custom conditions are checked first (allowing override of built-ins by matching conditionType); otherwise the condition's config is merged with its condition_type and parsed through BuiltInConditionConfig before dispatch.

Time-aware handlers manage their own evaluation date (defaulting to DateTime.now()). Tests should pin the clock via vi.setSystemTime(...).

Type Parameters

Type Parameter
TContext

Parameters

ParameterType
conditionCondition
contextTContext
customConditionsMap<string, CustomConditionDef<unknown, TContext>>

Returns

ConditionResult

On this page