Chunk converts arrays like <code>[1,2,3,4,5]</code> into arrays of arrays like <code>[[1,2], [3,4], ]</code>.
Chunk converts arrays like
[1,2,3,4,5] into arrays of arrays like
[[1,2], [3,4], ].
You can install chunk using npm.
npm install chunk
To chunk an array into an array of smaller arrays, simply call chunk:
> var chunk = require'chunk'> chunk1231 2 3
To chunk an array into an array of N-sized arrays, call chunk with N:
> chunk123 11 2 3> chunk123 31 2 3
The default chunk size is 2.