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

19 lines (15 loc) 374 B
/** * * @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; } export { takeFirstNoneFalsyValueOrLast as default }; //# sourceMappingURL=index.esm.js.map