chunkify
Chunks an iterable into smaller arrays of a specified size.
- Use a
for...ofloop over the given iterable, usingArray.prototype.push()to add each new value to the currentchunk. - Use
Array.prototype.lengthto check if the currentchunkis of the desiredsizeandyieldthe value if it is. - Finally, use
Array.prototype.lengthto check the finalchunkandyieldit if it's non-empty.