MCPcopy
hub / github.com/lodash/lodash / baseExtremum

Function baseExtremum

lodash.js:2904–2921  ·  view source on GitHub ↗

* The base implementation of methods like `_.max` and `_.min` which accepts a * `comparator` to determine the extremum value. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The iteratee invoked per iteration. * @param {Functi

(array, iteratee, comparator)

Source from the content-addressed store, hash-verified

2902 * @returns {*} Returns the extremum value.
2903 */
2904 function baseExtremum(array, iteratee, comparator) {
2905 var index = -1,
2906 length = array.length;
2907
2908 while (++index < length) {
2909 var value = array[index],
2910 current = iteratee(value);
2911
2912 if (current != null && (computed === undefined
2913 ? (current === current && !isSymbol(current))
2914 : comparator(current, computed)
2915 )) {
2916 var computed = current,
2917 result = value;
2918 }
2919 }
2920 return result;
2921 }
2922
2923 /**
2924 * The base implementation of `_.fill` without an iteratee call guard.

Callers 4

maxFunction · 0.85
maxByFunction · 0.85
minFunction · 0.85
minByFunction · 0.85

Calls 2

isSymbolFunction · 0.85
iterateeFunction · 0.70

Tested by

no test coverage detected