🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

promise-settled-aggregate

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promise-settled-aggregate

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

latest
Source
npmnpm
Version
0.5.1
Version published
Maintainers
1
Created
Source

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

Keywords

promise

FAQs

Package last updated on 05 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts