APPLE 025c69e553 wesmiler 点什么广告 3 лет назад
..
specs 025c69e553 wesmiler 点什么广告 3 лет назад
.npmignore 025c69e553 wesmiler 点什么广告 3 лет назад
LICENSE 025c69e553 wesmiler 点什么广告 3 лет назад
README.md 025c69e553 wesmiler 点什么广告 3 лет назад
index.js 025c69e553 wesmiler 点什么广告 3 лет назад
package.json 025c69e553 wesmiler 点什么广告 3 лет назад

README.md

NPM Version Build Status

coalescy

Simple function that return the first non null or undefined argument passed to it

Install

npm i --save coalescy

Usage

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

Example

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