MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / forEach

Function forEach

lib/test/angular/1.7.0/angular.js:361–401  ·  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, obj)`, where `value` *

(obj, iterator, context)

Source from the content-addressed store, hash-verified

359 */
360
361function forEach(obj, iterator, context) {
362 var key, length;
363 if (obj) {
364 if (isFunction(obj)) {
365 for (key in obj) {
366 if (key !== 'prototype' && key !== 'length' && key !== 'name' && obj.hasOwnProperty(key)) {
367 iterator.call(context, obj[key], key, obj);
368 }
369 }
370 } else if (isArray(obj) || isArrayLike(obj)) {
371 var isPrimitive = typeof obj !== 'object';
372 for (key = 0, length = obj.length; key < length; key++) {
373 if (isPrimitive || key in obj) {
374 iterator.call(context, obj[key], key, obj);
375 }
376 }
377 } else if (obj.forEach && obj.forEach !== forEach) {
378 obj.forEach(iterator, context, obj);
379 } else if (isBlankObject(obj)) {
380 // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
381 for (key in obj) {
382 iterator.call(context, obj[key], key, obj);
383 }
384 } else if (typeof obj.hasOwnProperty === 'function') {
385 // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed
386 for (key in obj) {
387 if (obj.hasOwnProperty(key)) {
388 iterator.call(context, obj[key], key, obj);
389 }
390 }
391 } else {
392 // Slow path for objects which do not have a method `hasOwnProperty`
393 for (key in obj) {
394 if (hasOwnProperty.call(obj, key)) {
395 iterator.call(context, obj[key], key, obj);
396 }
397 }
398 }
399 }
400 return obj;
401}
402
403function forEachSorted(obj, iterator, context) {
404 var keys = Object.keys(obj).sort();

Callers 15

copyFunction · 0.70
parseKeyValueFunction · 0.70
toKeyValueFunction · 0.70
angularInitFunction · 0.70
bootstrapFunction · 0.70
jqLiteBuildFragmentFunction · 0.70
jqLiteOffFunction · 0.70
jqLiteRemoveClassFunction · 0.70
jqLiteAddClassFunction · 0.70
angular.jsFile · 0.70
annotateFunction · 0.70
createInjectorFunction · 0.70

Calls 4

isFunctionFunction · 0.70
isArrayFunction · 0.70
isArrayLikeFunction · 0.70
isBlankObjectFunction · 0.70

Tested by

no test coverage detected