mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Bump to v3.0.0.
This commit is contained in:
28
internal/arrayMax.js
Normal file
28
internal/arrayMax.js
Normal file
@@ -0,0 +1,28 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used as references for `-Infinity` and `Infinity`. */
|
||||
var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
|
||||
|
||||
/**
|
||||
* A specialized version of `_.max` for arrays without support for iteratees.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @returns {*} Returns the maximum value.
|
||||
*/
|
||||
function arrayMax(array) {
|
||||
var index = -1,
|
||||
length = array.length,
|
||||
result = NEGATIVE_INFINITY;
|
||||
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
if (value > result) {
|
||||
result = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return arrayMax;
|
||||
});
|
||||
Reference in New Issue
Block a user