Every line of 'node js 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.
329 Loop: function Loop(node, parent, scope, state) { 330 var oldIgnoreLabeless = state.ignoreLabeless; 331 state.ignoreLabeless = true; 332 this.traverse(loopVisitor, state); 333 state.ignoreLabeless = oldIgnoreLabeless; 334 this.skip(); 335 },
42 function isCallbackOfArrayForEach(node) { 43 const parent = node.parent 44 45 return ( 46 parent.type === "CallExpression" && 47 parent.parent.type === "ExpressionStatement" && 48 parent.callee.type === "MemberExpression" && 49 parent.callee.property.type === "Identifier" && 50 parent.callee.property.name === "forEach" && 51 parent.arguments.length >= 1 && 52 parent.arguments[0] === node 53 ) 54 }
133 Loop: function Loop(node, parent, scope, file) { 134 var init = node.left || node.init; 135 if (isLet(init, node)) { 136 t.ensureBlock(node); 137 node.body._letDeclarators = [init]; 138 } 139 140 var blockScoping = new BlockScoping(this, this.get("body"), parent, scope, file); 141 return blockScoping.run(); 142 },
36 var _loop = function _loop(_key4) { 37 if (_key4 === "default") return 'continue'; 38 Object.defineProperty(exports, _key4, { 39 enumerable: true, 40 get: function get() { 41 return _animate[_key4]; 42 } 43 }); 44 };
117 var _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 };
427 var _loop = function _loop(key) { 428 if (data.hasOwnProperty(key)) { 429 _this.store[key] = []; 430 431 var _loop2 = function _loop2(anotherKey) { 432 if (data[key].hasOwnProperty(anotherKey)) { 433 var cellData = {}; 434 cellData.type = key; 435 cellData[VALUE] = anotherKey; 436 cellData.valueFor = anotherKey; 437 cellData.total = data[key][anotherKey][0]; 438 cellData[PERCENT] = 100; 439 cellData.color = _styles.DEFAULT_KEY_CELL_COLOR; 440 cellData.isLabel = true; 441 _this.store[key].push([cellData].concat(_toConsumableArray(data[key][anotherKey].map(function (value, index) { 442 var _ref; 443 444 var percent = _this._getPercentage(cellData.total, value); 445 return _ref = { 446 type: key 447 }, _defineProperty(_ref, VALUE, value), _defineProperty(_ref, 'valueFor', anotherKey), _defineProperty(_ref, 'total', cellData.total), _defineProperty(_ref, 'isTotal', index === 0), _defineProperty(_ref, PERCENT, percent), _defineProperty(_ref, 'color', index === 0 ? _styles.DEFAULT_CELL_COLOR : _this._shadeCellWithColor(percent)), _ref; 448 })))); 449 } 450 }; 451 452 for (var anotherKey in data[key]) { 453 _loop2(anotherKey); 454 } 455 } 456 };
30 function array(node, parent, scope) { 31 var uid = scope.generateUidIdentifierBasedOnNode(parent); 32 33 var container = util.template("array-comprehension-container", { 34 KEY: uid 35 }); 36 container.callee.shadow = true; 37 38 var block = container.callee.body; 39 var body = block.body; 40 41 if (traverse.hasType(node, scope, "YieldExpression", t.FUNCTION_TYPES)) { 42 container.callee.generator = true; 43 container = t.yieldExpression(container, true); 44 } 45 46 var returnStatement = body.pop(); 47 48 body.push(buildComprehension(node, function () { 49 return util.template("array-push", { 50 STATEMENT: node.body, 51 KEY: uid 52 }, true); 53 })); 54 body.push(returnStatement); 55 56 return container; 57 }
60 var _loop = function _loop() { 61 var prop = _step.value; 62 63 var setData = function setData(data) { 64 _this[prop] = data; 65 }; 66 var setError = function setError(err) { 67 _this[prop + 'Error'] = err; 68 if (err) _this.asyncError = true;else _this.asyncError = !!names.find(function (n) { 69 return _this[n + 'Error']; 70 }); 71 }; 72 var setLoading = function setLoading(flag) { 73 _this[prop + 'Loading'] = flag; 74 if (flag) _this.asyncLoading = true;else _this.asyncLoading = !!names.find(function (n) { 75 return _this[n + 'Loading']; 76 }); 77 }; 78 79 setLoading(true); 80 setError(undefined); 81 82 if (typeof asyncData[prop] !== 'function') { 83 console.error('asyncData.' + prop + ' must be funtion. actual: ' + asyncData[prop], _this); 84 return 'continue'; 85 } 86 asyncData[prop].apply(_this).then(function (res) { 87 _this.$nextTick(function () { 88 setData(res); 89 setLoading(false); 90 }); 91 }).catch(function (err) { 92 _this.$nextTick(function () { 93 setError(err); 94 setLoading(false); 95 }); 96 }); 97 };
217 function isLoop(node) { 218 return node.kind === ts.SyntaxKind.DoStatement 219 || node.kind === ts.SyntaxKind.WhileStatement 220 || node.kind === ts.SyntaxKind.ForStatement 221 || node.kind === ts.SyntaxKind.ForInStatement 222 || node.kind === ts.SyntaxKind.ForOfStatement; 223 }
9 function _Array_forEach(array, block, context) { 10 if (array == null) return; 11 //对String进行特殊处理 12 if(typeof array == 'string'){ 13 array = array.split(''); 14 } 15 var i = 0,length = array.length; 16 for (;i < length && block.call(context, array[i], (i+1), array)!==false; i++) {} 17 };