Every line of 'lodash foreach' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
57 function forEach(o, fn) { 58 if (Array.isArray(o)) { 59 return o.forEach(fn); 60 } 61 else { 62 for (var key in o) { 63 if (o.hasOwnProperty(key)) { 64 fn(o[key], key) 65 } 66 } 67 } 68 }
52 function forEach(array, iterator) { 53 for (var index = 0; index < array.length; index += 1) { 54 iterator(array[index], index); 55 } 56 }
389 function forEach (array, callback, thisObj) 390 { 391 for (var i=0; i
1026 export function foreach(obj: { [key: string]: V }, action: (key: string, value: V) => void) { 1027 1028 for (const name in obj) { 1029 if (obj.hasOwnProperty == null || obj.hasOwnProperty(name)) { 1030 action(name, obj[name]); 1031 } 1032 } 1033 }
9 function forEach (arr, callback) { 10 arr && arr.forEach(callback); 11 }
35 function foreach(arr, fn) { 36 if (!arr) return; 37 38 if (arr instanceof Array) { 39 for (var i=0; i
11 function forEach(array, callback, scope, splice) { 12 for (var all = [].concat(array), index = 0, length = all.length; index < length; ++index) { 13 if (splice) { 14 array.splice(index, 1); 15 } 16 17 callback.call(scope, all[index], index, array, scope); 18 } 19 }
25 function forEach(value, fn, path) { 26 path = path || ''; 27 28 if (Array.isArray(value)) { 29 forEachArray(value, fn, path); 30 } else if (isPlainObject(value)) { 31 forEachObject(value, fn, path); 32 } 33 }
25 function forEach(object, callback, context) { 26 var index, length; 27 if (object.length) { 28 if (Array.prototype.forEach) { 29 Array.prototype.forEach.call(object, callback, context); 30 } else { 31 for (index = 0, length = object.length; index < length; index += 1) { 32 callback.call(context || this, object[index], index, object); 33 } 34 } 35 } else { 36 for (index in object) { 37 if (object.hasOwnProperty(index)) { 38 callback.call(context || this, object[index], index, object); 39 } 40 } 41 } 42 }
53 var forEach = function forEach(list, iteratee) { 54 var record = arguments[2] === undefined ? { index: 0 } : arguments[2]; 55 56 for (var i = 0, len = list.length; i < len; i += 1) { 57 var item = list[i]; 58 if (isArr(item)) { 59 forEach(item, iteratee, record); 60 } else if (!isUndefined(item)) { 61 iteratee(item, record.index); 62 record.index += 1; 63 } 64 } 65 };