mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Optimize _.max and _.min.
Former-commit-id: 8c5dc8606d00e68dee63f06438e83c3bd65f3b29
This commit is contained in:
4
build.js
4
build.js
@@ -118,10 +118,10 @@
|
||||
'lastIndexOf': [],
|
||||
'lateBind': ['isFunction'],
|
||||
'map': ['forEach', 'isArray'],
|
||||
'max': ['forEach'],
|
||||
'max': ['forEach', 'isArray'],
|
||||
'memoize': [],
|
||||
'merge': ['forOwn', 'isArray', 'isPlainObject'],
|
||||
'min': ['forEach'],
|
||||
'min': ['forEach', 'isArray'],
|
||||
'mixin': ['forEach', 'functions'],
|
||||
'noConflict': [],
|
||||
'object': [],
|
||||
|
||||
@@ -2105,7 +2105,7 @@
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Collections
|
||||
* @param {Array|Object} collection The collection to iterate over.
|
||||
* @param {Array|Object|String} collection The collection to iterate over.
|
||||
* @param {Function} [callback] The function called per iteration.
|
||||
* @param {Mixed} [thisArg] The `this` binding of `callback`.
|
||||
* @returns {Mixed} Returns the maximum value.
|
||||
@@ -2126,7 +2126,7 @@
|
||||
length = collection ? collection.length : 0,
|
||||
result = computed;
|
||||
|
||||
if (callback || typeof length != 'number') {
|
||||
if (callback || !isArray(collection)) {
|
||||
callback = createCallback(callback, thisArg);
|
||||
forEach(collection, function(value, index, collection) {
|
||||
var current = callback(value, index, collection);
|
||||
@@ -2154,7 +2154,7 @@
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Collections
|
||||
* @param {Array|Object} collection The collection to iterate over.
|
||||
* @param {Array|Object|String} collection The collection to iterate over.
|
||||
* @param {Function} [callback] The function called per iteration.
|
||||
* @param {Mixed} [thisArg] The `this` binding of `callback`.
|
||||
* @returns {Mixed} Returns the minimum value.
|
||||
@@ -2169,7 +2169,7 @@
|
||||
length = collection ? collection.length : 0,
|
||||
result = computed;
|
||||
|
||||
if (callback || typeof length != 'number') {
|
||||
if (callback || !isArray(collection)) {
|
||||
callback = createCallback(callback, thisArg);
|
||||
forEach(collection, function(value, index, collection) {
|
||||
var current = callback(value, index, collection);
|
||||
|
||||
Reference in New Issue
Block a user