# promise-all-properties

> A helper function that recevies an object with a promise in each property and returns a promise that resolves to an object with the same properties and the resolved values of the promises

Latest version **6.0.0** (published 2026-02-23) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install promise-all-properties
pnpm add promise-all-properties
yarn add promise-all-properties
bun add promise-all-properties
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2026-02-23 |
| First published | 2016-10-14 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 30 |
| Author | Marcelo Waisman |
| Maintainers | marcelowa |

## Links

- npm: https://www.npmjs.com/package/promise-all-properties
- Repository: https://github.com/marcelowa/promise-all-properties
- Homepage: https://github.com/marcelowa/promise-all-properties#readme
- Issues: https://github.com/marcelowa/promise-all-properties/issues
- npm.io page: https://npm.io/package/promise-all-properties

## Recent versions

- 6.0.0 (latest) — 2026-02-23
- 5.0.2 — 2025-12-23
- 5.0.0 — 2025-03-04
- 5.0.0-alpha.5 — 2025-03-04
- 5.0.0-alpha.4 — 2025-03-04
- 5.0.0-alpha.3 — 2025-03-04
- 5.0.0-alpha.2 — 2025-03-04
- 5.0.0-alpha.1 — 2025-03-04
- 4.0.4 — 2024-06-25
- 4.0.2 — 2024-06-25
- 4.0.0 — 2024-04-07
- 3.1.1 — 2023-03-21
- 3.1.0 — 2023-03-21
- 3.0.6 — 2022-06-26
- 3.0.5 — 2022-01-29
- … 21 more at https://npm.io/package/promise-all-properties/versions

## README

# Promise all properties

[![tests](https://github.com/marcelowa/promise-all-properties/actions/workflows/ci.yaml/badge.svg)](https://github.com/marcelowa/promise-all-properties/actions/workflows/ci.yaml)

A helper function that receives an object with a [Promise] in each property and returns a promise that resolves to an object with the same properties and the resolved values of the promises.

The returned promise is rejected in the following cases:

1. The input argument is not an "object"
2. At least one of the promises are rejected

[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

## Requirements

- ES6 Promise supporting Javascript engine (browser or Node.js), or at least an ES6 Promise polyfill
- a node package manager installed (such as NPM or Yarn)

## Usage example (ES6/Typescript):

```javascript
import promiseAllProperties from "promise-all-properties";

const promisesObject = {
  someProperty: Promise.resolve("resolve value"),
  anotherProperty: Promise.resolve("another resolved value"),
};

const promise = promiseAllProperties(promisesObject);

promise.then((resolvedObject) => {
  console.log(resolvedObject);
  // {
  //   someProperty: 'resolve value',
  //   anotherProperty: 'another resolved value'
  // }
});
```

## Promise all settled properties

This helper function works the same as `promiseAllProperties`, except it uses [`Promise.allSettled`][allSettled] instead of [`Promise.all`][all]. It is therefore possible to get the status of all the promises, regardless of how many of them were fulfilled or rejected.

Usage example:

```javascript
import { promiseAllSettledProperties } from "promise-all-properties";

const promisesObject = {
  someProperty: Promise.resolve("resolve value"),
  anotherProperty: Promise.reject(new Error("a rejection")),
  yetAnotherProperty: Promise.reject(new Error("another rejection")),
};

const promise = promiseAllSettledProperties(promisesObject);

promise.then((resolvedObject) => {
  console.log(resolvedObject);
  // {
  //   someProperty: {status: 'fulfilled', value: 'resolve value'},
  //   anotherProperty: {status: 'rejected', reason: Error('a rejection')},
  //   yetAnotherProperty: {status: 'rejected', reason: Error('another rejection')}
  // }
});

// By comparison, promiseAllProperties(promisesObject) would reject with Error('a rejection')
```

[allSettled]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled
[all]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all

## Breaking changes

### v6.0.0

- Minimum Node.js version is now 18.0.0 to fix lodash prototype pollution vulnerability

### v4.0.0

- Minimum Node.js version is now 12.20.0 to support the promiseAllSettledProperties method

### v3.0.0

- Passing an Array of values causes the promise to be rejected as invalid
- Stricter TypeScript signature now errors on non-object arguments.

## Developers

### Run tests:

```bash
npm test
```

### Build:

```bash
npm run build
```

### Contributions:

PR's are welcome just make sure the the PR is squashed (one commit) and the commit messages starts with one of the following prefixes:

`[INITIAL]`: The initial commit  
`[FEAT]`: Only changes that creating new features or modofying existing features, that are not bug fixes  
`[FIX]`: Only bug fixes  
`[DOCS]`: Only Documentation changes  
`[STYLE]`: Only changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)  
`[REFACTOR]`: Only code changes that are neither fixes or features  
`[TEST]`: Only changes that are adding new tests or modifying existing tests  
`[TOOLS]`: Only changes that affect external processeses like build tools, dev tools, auxiliary tools and libraries such as documentation generation  
`[CLEANUP]`: Only code removal: code lines, comment lines or files without affecting the project whatsoever

## License

Public domain [Unlicense][unlicense]

[unlicense]: http://unlicense.org/

---
_Source: https://npm.io/package/promise-all-properties · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
