Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/siilwyn/promise-all-props
Like `Promise.all` but for object properties.
https://github.com/siilwyn/promise-all-props
deno promise
Last synced: 3 months ago
JSON representation
Like `Promise.all` but for object properties.
- Host: GitHub
- URL: https://github.com/siilwyn/promise-all-props
- Owner: Siilwyn
- License: isc
- Created: 2016-03-05T16:29:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T07:10:44.000Z (over 1 year ago)
- Last Synced: 2024-10-18T10:55:58.275Z (4 months ago)
- Topics: deno, promise
- Language: JavaScript
- Homepage: https://npmjs.com/promise-all-props
- Size: 120 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license.md
Awesome Lists containing this project
README
# promise-all-props
[![npm][npm-badge]][npm]
[![bundlephobia][bundlephobia-badge]][bundlephobia]Inspired by [bluebird's `Promise.props`](http://bluebirdjs.com/docs/api/promise.props.html).
Like `Promise.all` but for object properties instead of iterated values. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfilled values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected.
## Install
Node.js:
`npm install promise-all-props`Deno:
`https://deno.land/x/promise_all_props`## Usage example
```js
import { promiseAllProps } from 'promise-all-props';promiseAllProps({
foo: Promise.resolve('foo'),
bar: Promise.resolve('bar')
}).then((result) => {
console.log(result.foo, result.bar);
});
```[npm]: https://npmjs.com/package/promise-all-props
[npm-badge]: https://tinyshields.dev/npm/promise-all-props.svg
[bundlephobia]: https://bundlephobia.com/package/promise-all-props
[bundlephobia-badge]: https://tinyshields.dev/bundlephobia/size/promise-all-props.svg