blob: 229282002279e937b24149d481736a902e9cd7b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
'use strict';
export function mapPromises<T>(promises: {[key: string]: Promise<T>}): Promise<{[key: string]: T}> {
var p: Promise<void>[] = []
var ret: {[key: string]: T} = {}
_.forOwn(promises, (v, k) => {
p.push(v.then(r => {ret[k] = r;}));
});
return Promise.all(p).then(() => ret);
}
|