-
-
Notifications
You must be signed in to change notification settings - Fork 0
present
Nicholas Berlette edited this page Jun 19, 2025
·
1 revision
function isPresent<T>(it: T | null | undefined): it is NonNullable<T>;
Check if the given value is not null
or undefined
.
Name | Info |
---|---|
it |
The value to check. |
true
if the value is not null or undefined, or false
otherwise.
Primitives
- isMissing for the opposite of this function.
import { isPresent } from "jsr:@nick/is/present";
isPresent(null); // false
isPresent(undefined); // false
isPresent(0); // true
isPresent(""); // true
isPresent(false); // true
export type NonNullable<T> = T & {};
T