0.5.1 • Published 2 years ago

promise-settled-aggregate v0.5.1

Weekly downloads
-
License
Unlicense
Repository
github
Last release
2 years ago

promise-settled-aggregate

Await an array of promises to be settled, then reject with an AggregateError upon failure, or resolve with an array of values upon success.

It works like Promise.allSettled except it will reject with an AggregateError if some of the promises are rejected, otherwise it resolves with the fulfilled values like Promise.all.

try {
  const [a, b, c, d] = await promiseSettledAggregate([
    Promise.reject(new Error("Boom")),
    Promise.resolve(2),
    Promise.resolve(true),
    Promise.reject(new Error("Pow")),
  ]);
} catch (err) {
  err.errors.forEach(console.error);
}

You may copy the source code (see dist for JS) directly into your project as this library is published under the Unlicense license.

You can also install it as a npm dependency:

npm install promise-settled-aggregate
0.5.1

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.5

3 years ago

0.3.0

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago