MarkerPage is a npm library to implement simple pagination o JavaScript applications.
With MarkerPage you can implement a pagination out of any array of elements based on the page number and the limit of elements per page.
With npm installed, run
npm install makerpage
require('markerpage');
const pageableList = markerpage.makePagination(resultSet, start,end);
To create a pagination object you just need to call the "makePagination" function, and that receives as arguments the array to paginate, the page number and the total elements of the page.
The return pageable object:
const results = {
content:content,
totalPages:totalPage,
nextPage: nextPage,
actualPage:startParsed,
prevPage: previousPage,
}
- content : Page content.
- totalPages: Total pages based on the array.
- nextPage: Next page based on the actualPage, it may be null if the the number of the nextPage be greater than totalPages.
- actualPage: Actual page requested.
- PrevPage: Previous page based on the actualPage.
- Raphael Dias - RaphaelDiasc21