From dae6cd7331f092f7d40e45fa784109245cadbe3d Mon Sep 17 00:00:00 2001 From: Adam Laycock Date: Tue, 6 Jul 2021 14:12:17 +0100 Subject: [PATCH] fix: update warning on asyncForEach inSequence --- src/functions/async-for-each.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/functions/async-for-each.ts b/src/functions/async-for-each.ts index 863f5b6..cfed976 100644 --- a/src/functions/async-for-each.ts +++ b/src/functions/async-for-each.ts @@ -27,7 +27,7 @@ export const asyncForEach = async ( 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 @@ -37,11 +37,9 @@ export const asyncForEach = async ( return } - const promises: Promise[] = [] - - 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) }