@augment-vir/common
Version:
A collection of augments, helpers types, functions, and classes for any JavaScript environment.
13 lines (12 loc) • 527 B
JavaScript
import { mapObjectValues } from '../object/map-values.js';
/**
* Awaits all Promise properties inside of the given object and wraps them all in a single promise.
* This is akin to `Promise.all` but for an object instead of an array.
*
* @category Promise
* @category Package : @augment-vir/common
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export async function awaitAllPromisesInObject(originalObject) {
return mapObjectValues(originalObject, (key, value) => value);
}