Appearance
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