Skip to content

Commit

Permalink
use flatMap instead of for loop
Browse files Browse the repository at this point in the history
Co-authored-by: Lenz Weber-Tronic <mail@lenzw.de>
  • Loading branch information
EskiMojo14 and phryneas committed May 2, 2024
1 parent 9376ac8 commit bbb3f22
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/toolkit/src/matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,5 @@ export function isAsyncThunkAction<
return isAsyncThunkAction()(asyncThunks[0])
}

const matchers: Matcher<any>[] = []

for (const asyncThunk of asyncThunks) {
matchers.push(asyncThunk.pending, asyncThunk.rejected, asyncThunk.fulfilled)
}

return isAnyOf(...matchers)
return isAnyOf(...asyncThunks.flatMap(asyncThunk => [asyncThunk.pending, asyncThunk.rejected, asyncThunk.fulfilled]))
}

0 comments on commit bbb3f22

Please sign in to comment.