Skip to content

Commit

Permalink
fix: update warning on asyncForEach inSequence
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcath committed Jul 6, 2021
1 parent 4fef16e commit dae6cd7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/functions/async-for-each.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const asyncForEach = async <T>(

if (inSequence) {
console.warn(
'in sequence is going to be removed in the future, for 0.x it is default on, soon it will change to default off.'
'in sequence is going to be removed in the future, for 1.x it is default off.'
)
for (let index = 0; index < array.length; index++) {
//eslint-disable-next-line
Expand All @@ -37,11 +37,9 @@ export const asyncForEach = async <T>(
return
}

const promises: Promise<void>[] = []

array.forEach((value, index, arr) => {
promises.push(itterator(value, index, arr))
})
const promises = array.map((value, index, arr) =>
itterator(value, index, arr)
)

await Promise.all(promises)
}

0 comments on commit dae6cd7

Please sign in to comment.