Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
response = {}
someAsyncCall().then(function(rows){
_.forEach(rows, function(row){
if(typeof response[row.key] === 'undefined'){
response[row.key] = {count1:0,count2: row.count}
}
else{
response[row.key][count2]+=row.count
}
}
});
return new Promise()
);
someOtherAsyncCall().then(function(rows){
_.forEach(rows, function(row){
if(typeof response[row.key] === 'undefined'){
response[row.key] = {count2:0,count1: row.count}
}
else{
response[row.key][count1]+=row.count
}
}
res.send(200,response);
});
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment