Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sindresorhus/p-props

Like `Promise.all()` but for `Map` and `Object`
https://github.com/sindresorhus/p-props

Last synced: about 1 month ago
JSON representation

Like `Promise.all()` but for `Map` and `Object`

Awesome Lists containing this project

README

        

# p-props

> Like [`Promise.all()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) but for `Map` and `Object`

Useful when you need to run multiple promises concurrently and keep track of the fulfilled values by name.

## Install

```sh
npm install p-props
```

## Usage

```js
import pProps from 'p-props';
import got from 'got';

const fetch = async url => {
const {body} = await got(url);
return body;
};

const sites = {
ava: fetch('https://avajs.dev'),
todomvc: fetch('https://todomvc.com'),
github: fetch('https://github.com'),
foo: 'bar'
};

console.log(await pProps(sites));
/*
{
ava: '