this question may seem easy but I have 0 experience in javascript and got confused with the call-back functions.
The original code was doing some "async.each" with "async.parallel" stuff.
function fillMap(listElements, elementMap, params, callBack) {
async.each(listElements, function findElement(listElement, forEachCallBack) {
async.parallel(
{
fun1: function getUniqueElement(parallelCallBack) {
params.getResponse1(parallelCallBack);
},
fun2: function getElement(parallelCallBack) {
params.getResponse2(parallelCallBack);
}
},
function fillElement(err, res) {
if (err) {
return forEachCallBack(err);
}
elementMap[listElement] = res.body;
forEachCallBack();
});
}, callBack);
}
Now I don't need, say, the first function in async.parallel, I just need "getElement" but not "getUniqueElement". How should I remove it from the async.parallel body? And I don't I need the "async.parallel" But I don't know how can I call the "getElement" with "fillElement" still receives the response body..
Any suggestion?
Thanks!