Internal
The input iterable
The size of the groups
Returns a new generator yielding arrays of size n
grouped from the input iterable,
of type T[]
.
const input = [1, 2, 3, 4, 5, 6, 7, 8, 9];
const result = [...chunk(input, 3)];
console.log(result); // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Generated using TypeDoc
Returns a new generator that yields elements that are arrays of size
n
grouped from the input iterable, by takingn
elements at a time.The last group may have less than
n
elements.