Function chunkAsyncParallel

  • Executed the callback function on each chunk in the array limiting the number of parallel executions up to the parallelism number passed.

    Type Parameters

    • T

    • K

    Parameters

    • array: T[]

      Array with work items

    • fn: ((chunk, index, array) => K[] | Promise<K[]>)

      Callback functions executed for each chunk

        • (chunk, index, array): K[] | Promise<K[]>
        • Parameters

          • chunk: T[]
          • index: number
          • array: T[]

          Returns K[] | Promise<K[]>

    • chunkSize: number

      Size of each chunk

    • parallelism: number = 2

      Max number of parallel worker callbacks active

    Returns Promise<K[]>

    Array of results