export function chunk < T > ( array , size ) { if ( array . length === 0 ) { return [ ] ; } const chunks = [ ] ; for ( let i = 0 ; i < array . length ; i += size ) { chunks . push ( array . slice ( i , i + size ) ) ; } return chunks ; }