Created
April 18, 2018 01:50
-
-
Save erikjung/b4bc0d521f5c06f3684b863cc13bf128 to your computer and use it in GitHub Desktop.
Merging results of Promise.all
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
const a = new Promise(r => r({ a: 'A' })); | |
const b = new Promise(r => r({ b: 'B' })); | |
const c = new Promise(r => r({ c: 'C' })); | |
const result = (async () => { | |
const abc = await Promise.all([a, b, c]); | |
return abc.reduce((result, obj) => ({...result, ...obj}), {}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment