Function batchListAndCall

  • Generic function to batch a list and apply an async function to each batch

    Type Parameters

    • T
    • V

    Parameters

    • list: T[]

      The input list to batch and process

    • batchFunction: ((batch) => Promise<V[]>)

      The async function to apply to each batch

        • (batch): Promise<V[]>
        • Parameters

          • batch: T[]

          Returns Promise<V[]>

    • batchSize: number

      The maximum size of each batch

    Returns Promise<V[]>

    A promise that resolves to the flattened results of all batch operations

    Remarks

    This function prevents exeeding the max argument limit of node API endpoints