traxxx/src/utils/chunk.js

9 lines
243 B
JavaScript
Executable File

'use strict';
function chunk(array, chunkSize = 1000) {
return Array.from({ length: Math.ceil(array.length / chunkSize) })
.map((value, index) => array.slice(index * chunkSize, (index * chunkSize) + chunkSize));
}
module.exports = chunk;