New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →
Socket
Sign inDemoInstall
Socket

easy-loop

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-loop - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

5

lib/easy-loop.js

@@ -22,3 +22,3 @@ /**

{
easyTick(this, Array.from(arguments));
easyTick.tick(this, Array.from(arguments));
}

@@ -74,4 +74,5 @@ else

loop["once"] = loopOnce;
loop["tick"] = easyTick;
loop["tick"] = easyTick.tick;
loop["equalTick"] = easyTick.equalTick;
module.exports = loop;

45

lib/easy-tick.js
'use strict';
var loop = require('./easy-for');
/**
* tick(ms) 당 concurrency 개ė”Š ė‹¤í–‰í•œë‹¤.
*/
function easyTick(arr, ms, concurrency, func, last){

@@ -28,2 +31,3 @@ const MAX = arr.length;

});
if(TOTAL_PAGE === 0) runLast();

@@ -39,3 +43,42 @@ function runLast(){

}
exports.tick = easyTick;
/**
* tick(ms) 당 concurrency 개ė”Š ė‹¤í–‰í•˜ëŠ”데 (tick / concurrency) ms ė´ˆė”Š 간격ė„ 두ęŗ  ė‹¤í–‰í•œë‹¤.
* tick ė‹œę°„ ė•ˆė— concurrency 개ëĨŧ ė‹¤í–‰í•˜ëŠ”ęą´ ėœ„ė™€ 동ėŧ하다.
*/
function easyEqualTick(arr, ms, concurrency, func, last){
var MAX = arr.length;
var tickMS = ms / concurrency;
var mod = tickMS % 1;
tickMS = tickMS - mod;
var lastMS = 0;
var isLastMS = mod > 0;
if(isLastMS) lastMS = ms - tickMS * (concurrency - 1);
module.exports = easyTick;
var successCount = 0;
var stop = null;
var isEnd = false;
loop(arr, function(i, value, next){
var tick = isLastMS && (i + 1) % concurrency === 0 ? lastMS : tickMS;
setTimeout(() => {
if(stop) runLast();
else next();
}, tick);
func(i, value, function(e){
successCount++;
if(e) stop = e;
runLast();
});
});
if(MAX === 0) runLast();
function runLast(){
if(!last || isEnd) return;
if(MAX <= successCount || stop)
{
isEnd = true;
last(stop);
}
}
}
exports.equalTick = easyEqualTick;
{
"name": "easy-loop",
"version": "1.7.0",
"version": "1.7.1",
"description": "Easy sync loop processing for Node.js",

@@ -5,0 +5,0 @@ "main": "lib/easy-loop",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡ī¸ by Socket Inc