@@ -208,9 +208,9 @@ function isArrayLike(obj) {
208
208
*
209
209
* @description
210
210
* Invokes the `iterator` function once for each item in `obj` collection, which can be either an
211
- * object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value`
212
- * is the value of an object property or an array element and `key` is the object property key or
213
- * array element index. Specifying a `context` for the function is optional.
211
+ * object or an array. The `iterator` function is invoked with `iterator(value, key, obj )`, where `value`
212
+ * is the value of an object property or an array element, `key` is the object property key or
213
+ * array element index and obj is the `obj` itself . Specifying a `context` for the function is optional.
214
214
*
215
215
* It is worth noting that `.forEach` does not iterate over inherited properties because it filters
216
216
* using the `hasOwnProperty` method.
@@ -238,19 +238,19 @@ function forEach(obj, iterator, context) {
238
238
// Need to check if hasOwnProperty exists,
239
239
// as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
240
240
if ( key != 'prototype' && key != 'length' && key != 'name' && ( ! obj . hasOwnProperty || obj . hasOwnProperty ( key ) ) ) {
241
- iterator . call ( context , obj [ key ] , key ) ;
241
+ iterator . call ( context , obj [ key ] , key , obj ) ;
242
242
}
243
243
}
244
244
} else if ( obj . forEach && obj . forEach !== forEach ) {
245
245
obj . forEach ( iterator , context ) ;
246
246
} else if ( isArrayLike ( obj ) ) {
247
247
for ( key = 0 , length = obj . length ; key < length ; key ++ ) {
248
- iterator . call ( context , obj [ key ] , key ) ;
248
+ iterator . call ( context , obj [ key ] , key , obj ) ;
249
249
}
250
250
} else {
251
251
for ( key in obj ) {
252
252
if ( obj . hasOwnProperty ( key ) ) {
253
- iterator . call ( context , obj [ key ] , key ) ;
253
+ iterator . call ( context , obj [ key ] , key , obj ) ;
254
254
}
255
255
}
256
256
}
0 commit comments