libs/scully/src/lib/utils/chunk.js
/**
 * split an array in multiple chunks
 * @param arr
 * @param chunkSize
 */
split an array in multiple chunks
@param arr
@param chunkSize
split an array in multiple chunks @param arr @param chunkSize
function chunk(arr, chunkSize) {
    return arr.reduce((chunks, elm, index) => {
        if (index % chunkSize === 0) {
            chunks.push([]);
        }
        const currentChunk = chunks[chunks.length - 1];
        currentChunk.push(elm);
        return chunks;
    }, [[]]);
}
function chunk ( arr , chunkSize ) { return arr . reduce ( ( chunks , elm , index ) => { if ( index % chunkSize === 0 ) { chunks . push ( [ ] ) ; } const currentChunk = chunks [ chunks . length - 1 ] ; currentChunk . push ( elm ) ; return chunks ; } , [ [ ] ] ) ; }
split an array in multiple chunks
 @param arr
 @param chunkSize
split an array in multiple chunks @param arr @param chunkSize
/** create new chunk */