File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -7,17 +7,16 @@ import type { ObjMap } from './ObjMap.js';
7
7
* This is akin to bluebird's `Promise.props`, but implemented only using
8
8
* `Promise.all` so it will work with any implementation of ES6 promises.
9
9
*/
10
- export function promiseForObject < T > (
10
+ export async function promiseForObject < T > (
11
11
object : ObjMap < Promise < T > > ,
12
12
) : Promise < ObjMap < T > > {
13
13
const keys = Object . keys ( object ) ;
14
14
const values = Object . values ( object ) ;
15
15
16
- return Promise . all ( values ) . then ( ( resolvedValues ) => {
17
- const resolvedObject = Object . create ( null ) ;
18
- for ( let i = 0 ; i < keys . length ; ++ i ) {
19
- resolvedObject [ keys [ i ] ] = resolvedValues [ i ] ;
20
- }
21
- return resolvedObject ;
22
- } ) ;
16
+ const resolvedValues = await Promise . all ( values ) ;
17
+ const resolvedObject = Object . create ( null ) ;
18
+ for ( let i = 0 ; i < keys . length ; ++ i ) {
19
+ resolvedObject [ keys [ i ] ] = resolvedValues [ i ] ;
20
+ }
21
+ return resolvedObject ;
23
22
}
You can’t perform that action at this time.
0 commit comments