Utility function to split an array into batches of a specified size.
const items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]const batches = arrayBatch(items, 3)// Output: [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]] Copy
const items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]const batches = arrayBatch(items, 3)// Output: [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]
If batchSize is not a positive integer
Utility function to split an array into batches of a specified size.
Example
Throws
If batchSize is not a positive integer