|
||||
---|---|---|---|---|
.. | ||||
.idea | 11e3a9652a | vor 7 Jahren | ||
specs | 11e3a9652a | vor 7 Jahren | ||
.npmignore | 11e3a9652a | vor 7 Jahren | ||
LICENSE | 11e3a9652a | vor 7 Jahren | ||
README.md | 11e3a9652a | vor 7 Jahren | ||
index.js | 11e3a9652a | vor 7 Jahren | ||
package.json | 11e3a9652a | vor 7 Jahren |
Simple function that return the first non null or undefined argument passed to it
npm i --save coalescy
coalescy
simply return the first non nully of the passed elements. Null if all the values are null
it works the same as
a || b
but it works on falsie values too
var clsc = require('coalescy');
var obj = clsc(null, []); // obj = [];
obj = clsc(null, {}); // obj = {};
obj = clsc(null, [], {}); // obj = []; // the first non null
obj = clsc(null, undefined, 0, []) // 0