Skip to content

Instantly share code, notes, and snippets.

@jshcrowthe
Last active February 28, 2018 05:18
Show Gist options
  • Save jshcrowthe/d73a020cd7ef15071d7474773e5be903 to your computer and use it in GitHub Desktop.
Save jshcrowthe/d73a020cd7ef15071d7474773e5be903 to your computer and use it in GitHub Desktop.
Basic Array Chunking Function
function* chunkArray(dataset = [], offset = 5) {
let start = 0;
while (start < dataset.length) {
const chunk = dataset.slice(start, start + offset);
yield chunk;
start += offset;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment