1/** 2 * A specialized version of `baseExtremum` for arrays which invokes `iteratee` 3 * with one argument: (value). 4 * 5 * @private 6 * @param {Array} array The array to iterate over. 7 * @param {Function} iteratee The function invoked per iteration. 8 * @param {Function} comparator The function used to compare values. 9 * @param {*} exValue The initial extremum value. 10 * @returns {*} Returns the extremum value. 11 */ 12function arrayExtremum(array, iteratee, comparator, exValue) { 13 var index = -1, 14 length = array.length, 15 computed = exValue, 16 result = computed; 17 18 while (++index < length) { 19 var value = array[index], 20 current = +iteratee(value); 21 22 if (comparator(current, computed)) { 23 computed = current; 24 result = value; 25 } 26 } 27 return result; 28} 29 30module.exports = arrayExtremum; 31 32