Skip to main content

Function: withFallback()

withFallback<T>(value: T | null | undefined, fallback: T): T

Defined in: src/utils/fallbacks.ts:178

Get value with fallback, checking for null/undefined.

Type Parametersโ€‹

Tโ€‹

T

Parametersโ€‹

valueโ€‹

The value to check for null or undefined.

T | null | undefined

fallbackโ€‹

T

The fallback value to use if value is null or undefined.

Returnsโ€‹

T

The original value if not null/undefined; otherwise the fallback.