mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-13 20:37:48 +00:00
Update underscore.
Former-commit-id: 7041883ef258e3dc80d3c3751a5e4beecf0b4767
This commit is contained in:
5
vendor/underscore/underscore.js
vendored
5
vendor/underscore/underscore.js
vendored
@@ -79,7 +79,7 @@
|
||||
if (obj == null) return;
|
||||
if (nativeForEach && obj.forEach === nativeForEach) {
|
||||
obj.forEach(iterator, context);
|
||||
} else if (obj.length === +obj.length) {
|
||||
} else if (_.isArray(obj) || _.isArguments(obj)) {
|
||||
for (var i = 0, l = obj.length; i < l; i++) {
|
||||
if (iterator.call(context, obj[i], i, obj) === breaker) return;
|
||||
}
|
||||
@@ -343,7 +343,8 @@
|
||||
|
||||
// Return the number of elements in an object.
|
||||
_.size = function(obj) {
|
||||
return (obj.length === +obj.length) ? obj.length : _.keys(obj).length;
|
||||
var hasLength = _.isArray(obj) || _.isArguments(obj) || _.isString(obj);
|
||||
return hasLength ? obj.length : _.keys(obj).length;
|
||||
};
|
||||
|
||||
// Array Functions
|
||||
|
||||
Reference in New Issue
Block a user