createCheck
Stable · since 0.1.0
Builds the check helper that handlers receive via ctx.check. The runtime wires this for you on every run — createCheck is exported only for the rare cases where you need the same predicate DSL outside the handler context (custom middleware, condition-based testing, devtools panels).
is, all and any accept predicates over NonNullable<C[K]>. When a condition value is undefined or null, the predicate is never called and the result is false for that key.
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Param | Type | Description |
|---|---|---|
conditions | Record<string, unknown> | Snapshot map of condition values. Pass the same shape the runtime gives to handlers. |
Returns
Section titled “Returns”A CheckCtx object:
| Method | Signature | Result |
|---|---|---|
is(key, predicate) | (key, value => boolean) => boolean | true when the condition exists (non-null) and the predicate returns truthy. |
all(map) | ({ key: predicate, … }) => boolean | Every listed condition must exist and pass its predicate. |
any(map) | ({ key: predicate, … }) => boolean | At least one listed condition must exist and pass its predicate. |
Examples
Section titled “Examples”Inside a handler (the common case)
Section titled “Inside a handler (the common case)”You normally use ctx.check instead of constructing your own:
Standalone (advanced — outside a handler)
Section titled “Standalone (advanced — outside a handler)”Null safety
Section titled “Null safety”Related
Section titled “Related” createTrigger The handler receives a `check` instance automatically.
TriggerCtx Full handler context type, including `check`.
Conditions guide When to read conditions directly vs through `check`.
Required limitation Why `check` exists at all — V1 narrowing notes.