/** Splits array into several arrays */ export function intoChunks < T = unknown > ( array , chunkSize = 1 ) { const chunks = [ ] ; for ( let i = 0 ; i < Math . ceil ( array . length / chunkSize ) ; i ++ ) { chunks [ i ] = array . slice ( i * chunkSize , i * chunkSize + chunkSize ) ; } return chunks ; }