starry.chunk
v4.0.0
Published
Member of the starry suite—modular functions for iterable objects.
Downloads
14
Maintainers
Readme
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[]>