https://github.com/stefanpenner/promise.hash.helper
Inspired by Promise.all but rather then consuming an array it takes an object as input.
https://github.com/stefanpenner/promise.hash.helper
Last synced: 3 months ago
JSON representation
Inspired by Promise.all but rather then consuming an array it takes an object as input.
- Host: GitHub
- URL: https://github.com/stefanpenner/promise.hash.helper
- Owner: stefanpenner
- Created: 2020-02-13T23:55:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-11T02:27:18.000Z (about 2 years ago)
- Last Synced: 2025-04-19T01:22:04.251Z (3 months ago)
- Language: TypeScript
- Homepage:
- Size: 258 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# promise.hash.helper
Inspired by `Promise.all` but rather then consuming an array it takes an object as input, and "resolves" that objects values.
## Install
```sh
yarn add promise.hash.helper
```or
```sh
npm install --save promise.hash.helper
```## Usage
```js
const hash = require('promise.hash.helper');let promises = {
myPromise: resolve(1),
yourPromise: resolve(2),
theirPromise: resolve(3),
notAPromise: 4
};hash(promises).then(object => {
// object here is an object that looks like:
// {
// myPromise: 1,
// yourPromise: 2,
// theirPromise: 3,
// notAPromise: 4
// }
});
```