@extremejs/utils - v1.0.0-beta.23
    Preparing search index...

    Function chunk

    • It will create an array of elements, split into groups the length of size. If the array can't be split evenly, the final chunk will be the remaining elements.

      Type Parameters

      • Value

      Parameters

      • array: Value[]
      • size: number = 1

      Returns Value[][]

      1.0.0

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