Skip to content

Instantly share code, notes, and snippets.

@deathping1994
Last active November 18, 2016 19:43
Show Gist options
  • Save deathping1994/f270961e672dfb5fbbe09a70606ae064 to your computer and use it in GitHub Desktop.
Save deathping1994/f270961e672dfb5fbbe09a70606ae064 to your computer and use it in GitHub Desktop.
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