mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-24 20:06:55 +01:00
17 lines
521 B
TypeScript
17 lines
521 B
TypeScript
export const allSettledWithRejection = (
|
|
promises: Promise<any>[],
|
|
): Promise<any[]> =>
|
|
new Promise((resolve, reject) => {
|
|
Promise.allSettled(promises).then((results) => {
|
|
for (const result of results) {
|
|
if (result.status === 'rejected') {
|
|
reject(result.reason);
|
|
return;
|
|
}
|
|
}
|
|
resolve(
|
|
results.map((r) => (r as PromiseFulfilledResult<any>).value),
|
|
);
|
|
});
|
|
});
|