MCPcopy
hub / github.com/ternjs/tern / each

Function each

test/cases/generic_each.js:2–10  ·  view source on GitHub ↗
(obj, iterator, context)

Source from the content-addressed store, hash-verified

1// Underscore's each function (roughly)
2var each = function(obj, iterator, context) {
3 if (obj == null) return;
4 if (Array.prototype.forEach && obj.forEach === Array.prototype.forEach) {
5 obj.forEach(iterator, context);
6 } else if (obj.length === +obj.length) {
7 for (var i = 0, l = obj.length; i < l; i++)
8 iterator.call(context, obj[i], i, obj);
9 }
10};
11
12each([1, 2, 3, 4], function(n) {
13 n; //: number

Callers 4

generic_each.jsFile · 0.85
underscore.jsFile · 0.85
groupFunction · 0.85
flattenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…