Skip to content

Commit

Permalink
Revert "[web] Use reduce in safePromiseAll to make it work for 2D…
Browse files Browse the repository at this point in the history
… arrays (#309)"

This reverts commit 0b93db7.
  • Loading branch information
junhoyeo committed Oct 12, 2022
1 parent e7e5456 commit cbe1558
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/bento-common/utils/safer-promises.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export const safePromiseAll = async <T extends any>(promises: Promise<T>[]) =>
(await Promise.allSettled(promises)).reduce(
(acc, res) => (res.status === 'fulfilled' ? [...acc, res.value] : acc),
[] as T[],
(await Promise.allSettled(promises)).flatMap((res) =>
res.status === 'fulfilled' ? res.value : [],
);

export const safeAsyncFlatMap = async <T extends any, U extends any>(
Expand Down

0 comments on commit cbe1558

Please sign in to comment.