module.exports = function splitChunks(items, chunkSize) {
    let chunks = [];
    let chunk = [];

    for (let i = 0; i < items.length; i++) {
        chunk.push(items[i]);

        if (chunk.length === chunkSize) {
            chunks.push(chunk);
            chunk = [];
        }
    }

    if (chunk.length) {
        chunks.push(chunk);
    }

    return chunks;
};
