Skip to content

Instantly share code, notes, and snippets.

@ratpik
Created March 27, 2017 17:01
Show Gist options
  • Save ratpik/5f2dc08a8fc8485d4468aa6c50f3cee1 to your computer and use it in GitHub Desktop.
Save ratpik/5f2dc08a8fc8485d4468aa6c50f3cee1 to your computer and use it in GitHub Desktop.
Async With Recursion
it.only('Async should work with Recursion', function (done) {
var n = 10;
var f = function(callback) {
async.waterfall([
function (cb) {
n--;
cb(null, n);
},
function (b, cb) {
if (n===1) {
return cb(null);
}
f(cb);
}
], callback);
};
f(function (err) {
done();
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment