export default function paginateData ( data = [ ] , pageSize = 10 ) { const pageCount = Math . ceil ( data . length / pageSize ) ; const pages = [ ] ; for ( let i = 0 ; i < pageCount ; i ++ ) { const start = i * pageSize ; const page = data . slice ( start , start + pageSize ) ; pages . push ( page ) ; } if ( pages . length === 0 ) { pages [ 0 ] = [ ] ; } return pages ; }