@lucid-softworks/is-defined
v0.1.0
Published
A type guard that excludes undefined while preserving null.
Maintainers
Readme
@lucid-softworks/is-defined
Check whether a value is anything other than undefined, while narrowing its
TypeScript type. Unlike a non-nullish check, null is considered defined.
import { isDefined } from "@lucid-softworks/is-defined";
const values = [1, undefined, null].filter(isDefined);
// Array<number | null>