'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;
