4.0.0 • Published 7 years ago
starry.chunk v4.0.0
Member of the starry suite—modular functions for iterable objects.
Status
Applies to the whole suite.
Usage
function chunk<T = any>(
iterable: Iterable<T>,
size: number = 1
): Iterable<T[]>
Returns an iterable that yields groups of elements as a group of size size
is received from the iterable iterable
.
If the iterable ends with an insufficient number of elements required to fill a group, that final group is yielded.
Parameters:
- iterable:
Iterable<T>
- size:
number
Returns: Iterable<T[]>