prc b6c02717e6 Upload complete no-internet building environment. | vor 1 Jahr | |
---|---|---|
.. | ||
.idea | vor 1 Jahr | |
specs | vor 1 Jahr | |
.npmignore | vor 1 Jahr | |
LICENSE | vor 1 Jahr | |
README.md | vor 1 Jahr | |
index.js | vor 1 Jahr | |
package.json | vor 1 Jahr |
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