10 examples of 'lodash loop through array' in JavaScript

Every line of 'lodash loop through array' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
159async function loopAsync(arr, callback) {
160 for (let i = 0; i < arr.length; i++) {
161 arr[i] = await callback(arr[i]);
162 }
163 return await Promise.all(arr);
164}
7function parallel(array, fn) {
8
9 var length = array.length;
10 var results = new Array(length);
11 var loaded = 0;
12
13 function wrap(fn, index) {
14 fn(function callback(err) {
15 results[index] = arguments;
16 loaded++;
17 ready();
18 });
19 }
20
21 function ready() {
22 if (loaded >= length) {
23 fn.apply(null, results);
24 }
25 }
26
27 ready();
28
29 fold(array, 0, wrap);
30
31}
77function iterate(index, array, result) {
78 if (index >= array.length) {
79 return result;
80 } else return callback(array[index], index).then(function (res) {
81 result.push(res);
82 return iterate(index + 1, array, result);
83 });
84}
1export default function forArray(arr, iteratee) {
2 for (var i = 0; i < arr.length; i++) {
3 if (iteratee(arr[i], i, arr) === false) break;
4 }
5 return arr;
6}
22function completeLoopAction(array, value, action, arrayProp){
23 for (var j = 0; j < array.length; j++) {
24 if(arrayProp){
25 if (array[j][arrayProp] == value) {
26 break;
27 }
28 } else {
29 if (array[j] == value) {
30 break;
31 }
32 }
33 }
34 if (j == array.length) {
35 action();
36 }
37}
6function parallel (arr, cb) {
7 var results = []
8 , complete = 0
9 ;
10 for (var i=0;i
117var _loop3 = function _loop3(_j) {
118 match = childTests.every(function (tt) {
119 return test(children, _j, tt).match;
120 });
121
122 if (match) {
123 res.j = _j; // all tests true, continue with next key of pattern t
124
125 return "break";
126 }
127};
95exports.loop = function loop(fn, start, end, by) {
96 by = by || 1;
97 for (var i = start; i <= end; i += by) fn(i);
98};
389function forEach (array, callback, thisObj)
390{
391 for (var i=0; i
422function __loop__(iter, fn)
423{
424 var nodeCount = 0;
425 for (var i = 0; i < iter.length; ++i)
426 {
427 iter[i][0] = i;
428 iter[i][1] = nodeCount;
429 nodeCount += fn.apply(this, iter[i]);
430 //if (FBTrace.DBG_DOM) FBTrace.sysout("nodeCount", nodeCount);
431 }
432 return nodeCount;
433}

Related snippets