@feizheng/next-chunk
v1.0.0
Published
Creates an array of elements split into groups the length of size.
Downloads
4
Readme
next-chunk
Creates an array of elements split into groups the length of size.
installation
npm install -S @feizheng/next-chunk
apis
| api | type | description | | -------- | ----------------- | ------------------- | | nx.chunk | (inArray,inChunk) | Create split chunks |
usage
import '@feizheng/next-chunk';
const arr = [1,2,3,4,5,6,7,8];
const res = nx.chunk(arr, 3);
/*
[
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8 ]
]
*/