@eroyeroy/utils - v0.1.0
    Preparing search index...

    Function chunkArray

    • Splits array into chunks of at most size elements. The last chunk may be smaller than size.

      Type Parameters

      • T

      Parameters

      • array: readonly T[]

        The array to chunk.

      • size: number

        Chunk size (must be a positive integer).

      Returns T[][]

      chunkArray([1, 2, 3, 4, 5], 2) // => [[1, 2], [3, 4], [5]]
      chunkArray([], 3) // => []