forEachAsync

Type:Function
Status:stable
Platform:jsnode
@blackbyte.sugar.shared.array

Allow to make some async foreach on your arrays

Params

  1. array*-Array

    The array to loop on

  2. asyncFn*-Function

    The async function to call on each items

Example

import { forEachAsync } from '@blackbyte/sugar/array';
import { sleep } from '@blackbyte/sugar/function';
forEachAsync([0,1,2,3], async (item) => {
   await sleep(50);
   console.log(item);
});
// 0
// 1
// 2
// 3