Created
July 3, 2013 15:49
-
-
Save eyy/5919637 to your computer and use it in GitHub Desktop.
slice an array to small ones
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
exports.eachSlice = function(object, size){ | |
var index = - size, | |
slices = []; | |
while ((index += size) < object.length) { | |
slices.push(object.slice(index, index + size)); | |
} | |
return slices; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment