Skip to content

Welshman Docs / @welshman/lib / ifLet

Function: ifLet() ​

ifLet<T>(x, f): void

Defined in: packages/lib/src/Tools.ts:21

Executes a function if the value is defined

Type Parameters ​

• T

Parameters ​

x ​

The value to check

undefined | T

f ​

(x) => void

Function to execute if x is defined

Returns ​

void

Result of f(x) if x is defined, undefined otherwise