@geronimus/coalesce

0.1.3 • Public • Published

coalesce( [ value1, [ value2, [ ... ] ] ] )

As in SQL, coalesce() returns its first argument that is neither null nor undefined.

Examples

const coalesce = require( "@geronimus/coalesce" );

const result = coalesce(
  couldProduceNull( option1 ),
  couldProduceNull( option2 ),
  "default result"
);

Parameters

value1 any, value2 any, ...

Any number of values or expressions. The first that does not evaluate to null or undefined will be returned.

Readme

Keywords

none

Package Sidebar

Install

npm i @geronimus/coalesce

Weekly Downloads

2

Version

0.1.3

License

BSD-2-Clause

Unpacked Size

3.21 kB

Total Files

4

Last publish

Collaborators

  • geronimus