Skip to content

Instantly share code, notes, and snippets.

@Yoplitein
Created August 14, 2018 09:13
Show Gist options
  • Save Yoplitein/2c93a678717c0f847f238374ea77ef06 to your computer and use it in GitHub Desktop.
Save Yoplitein/2c93a678717c0f847f238374ea77ef06 to your computer and use it in GitHub Desktop.
quick n' dirty function to split an array into fixed-length chunks
const chunks = (
(array, size) =>
Array.from(
Array(array.length / size),
(_, x) =>
Array.from(
Array(size),
(_, y) => array[size * x + y]
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment