🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

aflow

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aflow - npm Package Compare versions

Comparing version
0.9.1
to
0.9.2
+21
test/test-speed.js
'use strict';
var qflow = require('../index');
module.exports = {
'repeatUntil 500k': function(t) {
var n = 0;
t.expect(2);
qflow.repeatUntil(
function(cb) {
n++;
cb(null, n >= 500000);
},
function(err, flag) {
t.equal(flag, true);
t.equal(n, 500000);
t.done();
}
);
},
};
+6
-6

@@ -43,13 +43,14 @@ /**

function _loop( func, callback, callDepth ) {
function _loop( callDepth ) {
try {
func( function(err, stop) {
if (alreadyReturned = err || stop) {
if (err || stop) {
alreadyReturned = err || stop;
return callback(err, stop);
}
else if (callDepth < 40) {
_loop(func, callback, callDepth + 1);
_loop(callDepth + 1);
}
else {
setImmediate(function() { _loop(func, callback, 0); });
setImmediate(function() { _loop(0); });
}

@@ -71,5 +72,4 @@ } );

}
// note: 2.5x faster if callback is passed in to _loop vs pulled from closure
_loop(func, callback, 0);
_loop(0);
}

@@ -76,0 +76,0 @@

{
"name": "aflow",
"version": "0.9.1",
"version": "0.9.2",
"description": "async flow control for calls with callbacks",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",