Skip to content

Instantly share code, notes, and snippets.

View pokey's full-sized avatar

Pokey Rule pokey

View GitHub Profile
@pokey
pokey / PromiseAllObject.ts
Last active September 25, 2020 11:49 — forked from d0mmie/PromiseAllObject.js
Object version of promiseAll
type PromiseAllObjectInput<T> = {
[P in keyof T]: Promise<T[P]>;
};
export async function promiseAllObject<T>(
obj: PromiseAllObjectInput<T>,
): Promise<T> {
const promiseArray = await Promise.all(Object.values(obj));
return Object.keys(obj)