1 var isSymbol = require('./isSymbol');
4 * The base implementation of methods like `_.max` and `_.min` which accepts a
5 * `comparator` to determine the extremum value.
8 * @param {Array} array The array to iterate over.
9 * @param {Function} iteratee The iteratee invoked per iteration.
10 * @param {Function} comparator The comparator used to compare values.
11 * @returns {*} Returns the extremum value.
13 function baseExtremum(array, iteratee, comparator) {
15 length = array.length;
17 while (++index < length) {
18 var value = array[index],
19 current = iteratee(value);
21 if (current != null && (computed === undefined
22 ? (current === current && !isSymbol(current))
23 : comparator(current, computed)
25 var computed = current,
32 module.exports = baseExtremum;