101
Version:
common javascript utils that can be required selectively that assume es5+
16 lines (14 loc) • 366 B
JavaScript
/**
* @module {function} 101/exists
* @type {function}
*/
/**
* Returns false for null and undefined, true for everything else.
* @function module:101/exists
* @param val {*} - value to be existance checked
* @return {boolean} whether the value exists or not
*/
module.exports = exists;
function exists (val) {
return val !== undefined && val !== null;
}