mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 07:17:50 +00:00
removed _.each support of objects with their own 'each' method -- it was a little bit funky
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
/*------------------------ Collection Functions: ---------------------------*/
|
||||
|
||||
// The cornerstone, an each implementation.
|
||||
// Handles objects implementing forEach, each, arrays, and raw objects.
|
||||
// Handles objects implementing forEach, arrays, and raw objects.
|
||||
_.each = function(obj, iterator, context) {
|
||||
var index = 0;
|
||||
try {
|
||||
@@ -41,8 +41,6 @@
|
||||
obj.forEach(iterator, context);
|
||||
} else if (obj.length) {
|
||||
for (var i=0, l = obj.length; i<l; i++) iterator.call(context, obj[i], i, obj);
|
||||
} else if (obj.each) {
|
||||
obj.each(function(value) { iterator.call(context, value, index++, obj); });
|
||||
} else {
|
||||
for (var key in obj) if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
iterator.call(context, obj[key], key, obj);
|
||||
|
||||
Reference in New Issue
Block a user