source: frontend/node_modules/underscore/amd/each.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 746 bytes
Line 
1define(['./_optimizeCb', './_isArrayLike', './keys'], function (_optimizeCb, _isArrayLike, keys) {
2
3 // The cornerstone for collection functions, an `each`
4 // implementation, aka `forEach`.
5 // Handles raw objects in addition to array-likes. Treats all
6 // sparse array-likes as if they were dense.
7 function each(obj, iteratee, context) {
8 iteratee = _optimizeCb(iteratee, context);
9 var i, length;
10 if (_isArrayLike(obj)) {
11 for (i = 0, length = obj.length; i < length; i++) {
12 iteratee(obj[i], i, obj);
13 }
14 } else {
15 var _keys = keys(obj);
16 for (i = 0, length = _keys.length; i < length; i++) {
17 iteratee(obj[_keys[i]], _keys[i], obj);
18 }
19 }
20 return obj;
21 }
22
23 return each;
24
25});
Note: See TracBrowser for help on using the repository browser.