UNPKG

502 BJavaScriptView Raw
1
2
3 /**
4 * Array forEach
5 */
6 function forEach(arr, callback, thisObj) {
7 if (arr == null) {
8 return;
9 }
10 var i = -1,
11 len = arr.length;
12 while (++i < len) {
13 // we iterate over sparse items since there is no way to make it
14 // work properly on IE 7-8. see #64
15 if ( callback.call(thisObj, arr[i], i, arr) === false ) {
16 break;
17 }
18 }
19 }
20
21 module.exports = forEach;
22
23