Skip to main content

Function: shortcutNulls()

shortcutNulls<T>(fn, nullVal?): T

Defined in: packages/core/src/utils/shortcut-nulls.ts:7

Returns a function that returns null if any of the arguments are null or undefined, otherwise it calls the original function. Used in languages with three-valued logic to avoid having to check for nulls in every function.

Type Parameters

Type ParameterDescription
T extends (...args) => anyThe function type being wrapped.

Parameters

ParameterTypeDefault value
fnTundefined
nullValanynull

Returns

T