Skip to content

Function: when() ​

when<R>(condition, onTrue, onFalse?): R | undefined

Defined in: src/runtime.ts:38

Conditionally execute a callback

Type Parameters ​

R ​

R

Parameters ​

condition ​

unknown

The condition to check (value or zero-arg function returning boolean)

onTrue ​

() => R

The callback to execute if the condition is truthy

onFalse? ​

() => R

The callback to execute if the condition is falsy

Returns ​

R | undefined

The result of the executed callback or undefined

Documentation of 1.0.13 , built from cf61d3b on 1.0.13 by pipeline #2985011498 on 2026-10-21.