Closed deltazero-cz closed 3 years ago
Hi, I've made a fork which adds support for desired result being undefined.
Real life usage:
/** * Returns the lowest of array's values. * If empty, returns undefined. * If not all values are numeric, returns NaN. * * @function * @returns {number|undefined} * * @example <caption>returns 1</caption> * [1, 2, 3, 4, 5, 6].min() * // => 1 * * @example <caption>returns 1</caption> * [{num: 1}, {num: 2}, {num: 3}, {num: 4}, {num: 5}, {num: 6}].map(r => r.num).min() * // => 1 * * @example <caption>returns NaN</caption> * [1, 2, 3, 'Four', 5, 6].min() * // => NaN * * @example <caption>returns undefined</caption> * [].min() * // => undefined */ Array.prototype.min = function() { return this.length ? Math.min(...this) : undefined }
Coverage increased (+0.2%) to 77.202% when pulling c3edabb57de66585df10c593021dcfccb818cf2f on deltazero-cz:master into ccd6cdbff8a4db98d20da8ac1868558a45913005 on yamadapc:master.
Thank you
Hi, I've made a fork which adds support for desired result being undefined.
Real life usage: