forked from DebaucheryLibrarian/traxxx
9 lines
245 B
JavaScript
9 lines
245 B
JavaScript
|
'use strict';
|
||
|
|
||
|
function chunk(array, chunkSize) {
|
||
|
return Array.from({ length: Math.ceil(array.length / chunkSize) })
|
||
|
.map((value, index) => array.slice(index * chunkSize, (index * chunkSize) + chunkSize));
|
||
|
}
|
||
|
|
||
|
module.exports = chunk;
|