mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
lodash: Ensure max and min do not error when computing the result of massive arrays. [cederberg, jddalton, jeeyoungk]
Former-commit-id: af982790c3bb62777523f972a95b7115fb645180
This commit is contained in:
@@ -139,8 +139,9 @@
|
||||
'top':
|
||||
'var current, computed = -Infinity, result = computed;\n' +
|
||||
'if (!callback) {\n' +
|
||||
'if (isArray(collection) && collection[0] === +collection[0])' +
|
||||
'return Math.max.apply(Math, collection);\n' +
|
||||
'if (isArray(collection) && collection[0] === +collection[0]) {\n' +
|
||||
'try { return Math.max.apply(Math, collection); } catch(e) { }\n' +
|
||||
'}\n' +
|
||||
'if (isEmpty(collection))' +
|
||||
'return result\n' +
|
||||
'} else if (thisArg) callback = bind(callback, thisArg)',
|
||||
|
||||
Reference in New Issue
Block a user