MCPcopy
hub / github.com/binux/qiandao / forEach

Function forEach

web/static/components/angularjs/angular.js:312–338  ·  view source on GitHub ↗

* @ngdoc function * @name angular.forEach * @module ng * @kind function * * @description * Invokes the `iterator` function once for each item in `obj` collection, which can be either an * object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value` * is t

(obj, iterator, context)

Source from the content-addressed store, hash-verified

310 * @returns {Object|Array} Reference to `obj`.
311 */
312function forEach(obj, iterator, context) {
313 var key;
314 if (obj) {
315 if (isFunction(obj)) {
316 for (key in obj) {
317 // Need to check if hasOwnProperty exists,
318 // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
319 if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {
320 iterator.call(context, obj[key], key);
321 }
322 }
323 } else if (isArray(obj) || isArrayLike(obj)) {
324 for (key = 0; key < obj.length; key++) {
325 iterator.call(context, obj[key], key);
326 }
327 } else if (obj.forEach && obj.forEach !== forEach) {
328 obj.forEach(iterator, context);
329 } else {
330 for (key in obj) {
331 if (obj.hasOwnProperty(key)) {
332 iterator.call(context, obj[key], key);
333 }
334 }
335 }
336 }
337 return obj;
338}
339
340function sortedKeys(obj) {
341 var keys = [];

Callers 15

extendFunction · 0.85
mapFunction · 0.85
copyFunction · 0.85
parseKeyValueFunction · 0.85
toKeyValueFunction · 0.85
angularInitFunction · 0.85
bootstrapFunction · 0.85
jqLiteOffFunction · 0.85
jqLiteRemoveClassFunction · 0.85
jqLiteAddClassFunction · 0.85
angular.jsFile · 0.85
eventHandlerFunction · 0.85

Calls 3

isArrayFunction · 0.85
isArrayLikeFunction · 0.85
isFunctionFunction · 0.70

Tested by

no test coverage detected