Maybe Promise.join(object)? Also, if a map is passed (or any iterable), it should be joined into a map.
At the most basic level: ```js Promise.join = (o) => { let isMap = o[Symbol.iterator] != null let ps = ( isMap ? Array.from : Object.entries )(o) let ks = ps.map(p => p[0]) return Promise.all(ps.map(p => p[1])) .then(vs => { let ps = vs.map((v, i) => [ks[i], v]) return isMap ? new Map(ps) : Object.fromEntries(ps) }) } ``` On Sun, Oct 13, 2019 at 13:40 Cyril Auburtin <cyril.aubur...@gmail.com> wrote: > OP probably means he would like Promise.all to return an object as well, > if an object if given > > It's possible to hack an object to be iterable, but Promise.all > already return an array unfortunately > > On Sun, Oct 13, 2019 at 7:16 PM Boris Zbarsky <bzbar...@mit.edu> wrote: > >> On 10/12/19 12:52 AM, Jacob Bloom wrote: >> > const responses = await Promise.all(requests); >> >> As opposed to: >> >> const responses = await Primise.all(requests.values()); >> >> which works right now? >> >> -Boris >> _______________________________________________ >> es-discuss mailing list >> es-discuss@mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -- ----- Isiah Meadows cont...@isiahmeadows.com www.isiahmeadows.com
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss