The following code returns only the resultset of getpricingSummary
async.waterfall([
function(callback){
getpricingSummary(elementsParam, function(workloadinfo) {
callback(workloadinfo);
});
},
function(callback){
getPricingforResourceIdentifiers('vm/hpcloud/nova/small,image/hpcloud/nova/ami-00000075', function(pricingDetail) {
callback(pricingDetail);
});
}],
function(result){
console.log(result);
});
]);
The
asynclibrary follows the common Node.js pattern oferror-first callbacks.To signify that the task was "successful," the 1st argument should be falsy (typically
null) with any data as the 2nd or after argument.Also note that
async.waterfall()is intended for passing a result from one task to the next, arriving at just theresultfrom the final task (or anerror).If you want to collect results from each task, try
async.series(). With it,resultwill be anArrayof the data passed from each task.