Array helpers for splitting work into bounded batches.
List.chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]] Copy
List.chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]
Bayu Dwiyan Satria
1.3.0
Static
Splits a list into consecutive batches of at most size elements.
size
The element type.
The list to split. Not modified.
Maximum batch length. Invalid sizes use one.
The batches in input order, or an empty array for empty input.
Fractional sizes are truncated. Non-finite sizes and sizes below one use a batch size of one, keeping invalid configuration from producing an unbounded batch.
Array helpers for splitting work into bounded batches.
Example
Author
Bayu Dwiyan Satria
Version
1.3.0
Since
1.3.0