Use Promise.allSettled like Promise.all
npm install allfulfilled



allfulfilled is a Node.js package for using
Promise.allSettled
like Promise.all.
Install using npm:
`` sh`
npm install --save allfulfilled
Returns a new Promise that is fulfilled with an array of fulfillment values when all the specified promises areError
fulfilled, or rejected with an if any of promises are rejected.
This function behaves similarly to Promise.all but uses Promise.allSettled internally to collect all rejectionError
reasons before rejecting with a single .
Optionally, toError can be specified to map all rejection reasons to a single Error. Defaults to aggregate, whichAggregateError
wraps all rejection reasons into an .
#### Examples
` javascript
import { allFulfilled, first } from "allfulfilled";
await allFulfilled([Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)]);
//=> [1, 2, 3]
await allFulfilled([Promise.resolve(1), Promise.reject(new Error("Oops")), Promise.resolve(3)]);
//=> AggregateError
await allFulfilled([Promise.resolve(1), Promise.reject(new Error("Oops")), Promise.resolve(3)], first());
//=> Error
`
Maps all reasons that any Promise was rejected with to a single Error.
A ReasonsErrorMapper is only called with a non-empty array of reasons.
There are a several ReasonsErrorMapper function providers built-in.
#### aggregate([message])
Returns a ReasonsErrorMapper that wraps all the reasons a Promise was rejected with into an AggregateError.
Optionally, message can be specified for the AggregateError.
#### first([toError])
Returns a ReasonsErrorMapper that returns the first reason a Promise was rejected with as an Error.
If toError is specified and the first reason is not an Error, toError will be used to map the first reason toError
an .
#### last([toError])
Returns a ReasonsErrorMapper that returns the last reason a Promise was rejected with as an Error.
If toError is specified and the last reason is not an Error, toError will be used to map the last reason to anError`.
If you have any problems with this package or would like to see changes currently in development, you can do so
here.
If you want to contribute, you're a legend! Information on how you can do so can be found in
CONTRIBUTING.md. We want your suggestions and
pull requests!
A list of all contributors can be found in
AUTHORS.md.
Copyright © 2026 neocotic
See LICENSE.md for more information on our MIT
license.