Created
May 30, 2016 21:26
-
-
Save fubar/ea62936f5025221bc062b47b279e5020 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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