/is/defined
stdChecks if the given value is defined.
Type signature
(x?: unknown) => boolean
Examples
defined(undefined);
// ⇒ false
Try in REPL
defined(null);
// ⇒ true
Try in REPL
defined(0);
// ⇒ true
Try in REPL
defined({ a: 1 });
// ⇒ true
Try in REPL
Questions
- How to check if a given value is defined?
- How to check if a given value is not undefined?