Created
May 20, 2018 08:21
-
-
Save benjaminW78/db5e8b9356e4ccc8809d5d1e82b3c0e2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const batchOfWhatUWant = (items, batchLength = 5000) => { | |
const allItems = items | |
const batchCount = allItems.length / batchLength | |
return Array(Math.ceil(batchCount)) | |
.fill(0) | |
.map((element, index) => index * batchLength) | |
.map(start => allItems.slice(start, start + batchLength)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment