A JavaScript utility that returns the first argument that is not null, functioning similarly to SQL's COALESCE. It works for strings, numbers, booleans, and objects, but treats undefined as null by default. The current stable version is 1.0.21, and the package is in maintenance mode with no active development. It is lightweight and has no dependencies, but lacks TypeScript definitions and does not handle nested null values or functions.
npm install extantNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of extant to get the first non-null value, showing that falsy non-null values are preserved.
Pass undefined as a value; it will be treated as null and ignored.
Use a recursive function if you need deep coalescing.
Create your own .d.ts file or use @types/extant if available.
Use import extant from 'extant' or set type: module in package.json.
Use import extant from 'extant' (default import).
No dependency data recorded yet.