mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Reduce baseExtremum.
This commit is contained in:
23
lodash.js
23
lodash.js
@@ -624,28 +624,19 @@
|
|||||||
* @returns {*} Returns the extremum value.
|
* @returns {*} Returns the extremum value.
|
||||||
*/
|
*/
|
||||||
function baseExtremum(array, iteratee, comparator) {
|
function baseExtremum(array, iteratee, comparator) {
|
||||||
var computed,
|
var index = -1,
|
||||||
result,
|
|
||||||
index = -1,
|
|
||||||
length = array.length;
|
length = array.length;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var value = array[index],
|
var value = array[index],
|
||||||
current = iteratee(value);
|
current = iteratee(value);
|
||||||
|
|
||||||
if (current === current && current != null) {
|
if (current != null && (computed === undefined
|
||||||
computed = current;
|
? current === current
|
||||||
result = value;
|
: comparator(current, computed)
|
||||||
break;
|
)) {
|
||||||
}
|
var computed = current,
|
||||||
}
|
result = value;
|
||||||
while (++index < length) {
|
|
||||||
var value = array[index],
|
|
||||||
current = iteratee(value);
|
|
||||||
|
|
||||||
if (current != null && comparator(current, computed)) {
|
|
||||||
computed = current;
|
|
||||||
result = value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user