mout
Version:
Modular Utilities
20 lines (18 loc) • 430 B
text/typescript
/**
* Array forEach
*/
function forEach(arr, callback, thisObj?: any) {
if (arr == null) {
return;
}
let i = -1;
const len = arr.length;
while (++i < len) {
// we iterate over sparse items since there is no way to make it
// work properly on IE 7-8. see #64
if (callback.call(thisObj, arr[i], i, arr) === false) {
break;
}
}
}
export default forEach;