Created
March 27, 2017 17:01
-
-
Save ratpik/5f2dc08a8fc8485d4468aa6c50f3cee1 to your computer and use it in GitHub Desktop.
Async With Recursion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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