Created
November 4, 2013 11:17
-
-
Save milafrerichs/7301183 to your computer and use it in GitHub Desktop.
Split array into chunks of arrays
changed to coffeescript from http://stackoverflow.com/a/10456644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array::chunk = (chunkSize) -> | |
array = this | |
[].concat.apply [], array.map((elem, i) -> | |
(if i % chunkSize then [] else [array.slice(i, i + chunkSize)]) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://stackoverflow.com/a/10456644