Skip to content

Instantly share code, notes, and snippets.

@arisolt
Last active December 11, 2015 09:08
Show Gist options
  • Save arisolt/4577373 to your computer and use it in GitHub Desktop.
Save arisolt/4577373 to your computer and use it in GitHub Desktop.
var async = require('async')
var final_array = [];
function a(param) {
console.log("a");
return param * 10;
}
function b() {
function c(callback){
var arr = [];
for (var i = 1; i <= 3; i++) {
arr.push(a(i));
};
callback(null, arr);
};
function d(arr, callback){
async.reduce(arr, final_array, function(memo, item, callback){
callback(memo.push(item));
}, function(err, results){
console.log(results);
})
}
async.waterfall([c, d]);
}
b();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment