array-chunk-split
v2.0.15
Published
Split an array into arrays with max chunk length
Downloads
1,718
Maintainers
Readme
README
Split an array into arrays with max chunk length
install
yarn add array-chunk-split
import { arrayChunkBySize, arrayChunkSplit } from 'array-chunk-split';
const arr = [1, 2, 3, 4, 5, 6, 7, 8];
console.dir(arrayChunkSplit(arr, 4));
// => [[1, 2], [3, 4], [5, 6], [7, 8]]
console.dir(arrayChunkBySize(arr, 5));
// => [[1, 2, 3, 4, 5], [6, 7, 8]]