isDefined
isDefined<
T>(value):value is T
Defined in: filtration/is-defined.ts:22
Type guard to check if a value is defined (not null or undefined). Returns a boolean indicating whether the value is defined with βisβ for type narrowing.
Type Parameters
T
T
Describes the type of the value if the value is defined
Parameters
value
The value to check
T | null | undefined
Returns
value is T
True if the value is defined (not null or undefined); otherwise, false
Example
// Return trueisDefined(5); // trueisDefined("hello"); // true
// Return falseisDefined(null); // falseisDefined(undefined); // false