-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
Description
index.js
export function promiseAny(promises) {
const errors = [];
return new Promise((resolve, reject) => {
promises.forEach((promise) => {
Promise.resolve(promise)
.then(resolve)
.catch((err) => {
errors.push(err);
if (errors.length === promises.length) {
reject(new AggregateError(errors));
}
});
});
});
}