Immutable.js does not provide it right out of the box.
Here is a function that splits the list into equal sized pieces. The last fragment may be smaller if the list cannot be divided evenly.
function splitIntoChunks(list, chunkSize = 1) { return Immutable.Range(0, list.count(), chunkSize) .map(chunkStart => list.slice(chunkStart, chunkStart + chunkSize)); }
First, it lists the indices at which each piece should begin, and then converts the list of indices into a list of fragments spanning from each index to the index plus the block size.
It looks simple and effective for me.
source share