Skip to content

Instantly share code, notes, and snippets.

@fubar
Created May 30, 2016 21:26
Show Gist options
  • Save fubar/ea62936f5025221bc062b47b279e5020 to your computer and use it in GitHub Desktop.
Save fubar/ea62936f5025221bc062b47b279e5020 to your computer and use it in GitHub Desktop.
var promises = ['foo', 'bar'].map(id => {
return new Promise(resolve => {
couchDb.get(
id,
function (error, data) {
// error handling
return resolve(data);
}
)
});
});
Promise.all(promises)
.then(data => {
console.log(data);
})
.catch(error => {
console.log(error);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment