UNPKG

first-none-falsy-value-or-last

Version:

a function which returns the first none falsy value or the last value, if alle values are falsy

24 lines (18 loc) 488 B
var takeFirstNoneFalsyValueOrLast = (function () { 'use strict'; /** * * @param {*} args * @return {*} */ function takeFirstNoneFalsyValueOrLast() { const args = Array.prototype.slice.call(arguments); const result = args.find((value) => !!value); if (result === undefined) { return args.pop(); } return result; } return takeFirstNoneFalsyValueOrLast; }()); //# sourceMappingURL=index.js.map