kaven-basic - v6.0.0
    Preparing search index...

    Function ArraySplit

    • Splits an array into chunks of a specified size.

      Type Parameters

      • T

      Parameters

      • array: T[]

        The array to split into chunks.

      • size: number

        The maximum size of each chunk.

      • OptionalfromLeft: boolean

        If true, splits the array from left to right. If false or omitted, splits from right to left, placing the smaller chunk (if any) at the start.

      Returns T[][]

      An array of arrays, where each sub-array is a chunk of the original array.

      ArraySplit([1, 2, 3, 4, 5], 2, true); // [[1, 2], [3, 4], [5]]
      ArraySplit([1, 2, 3, 4, 5], 2); // [[1], [2, 3], [4, 5]]

      4.0.0

      2025-06-27