|
|
пре 3 година | |
|---|---|---|
| .. | ||
| specs | пре 3 година | |
| .npmignore | пре 3 година | |
| LICENSE | пре 3 година | |
| README.md | пре 3 година | |
| index.js | пре 3 година | |
| package.json | пре 3 година | |
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