commit
4047a7ec23
378 changed files with 29334 additions and 0 deletions
11
lib/array.js
Normal file
11
lib/array.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export function chunk(arr, size) {
|
||||
const chunks = [];
|
||||
|
||||
let index = 0;
|
||||
while (index < arr.length) {
|
||||
chunks.push(arr.slice(index, size + index));
|
||||
index += size;
|
||||
}
|
||||
|
||||
return chunks;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue