js-paginator
This is a js library for paginating an array of data,
###Installation
npm i js-paginator
###Usage
conts {paginate} = require('js-paginator)
paginate(yourArray, {limit:5,page:2})
It returns an object containing data of current page and its metadats like.
{
page: 2, //current page
limit: 5, //number ot items on the page
has_next: true, //wheather it has next page or not
has_prev: true, //wheather it has previous page or not
next_page: 3, //what next page will be
prev_page: 1, //what previous page was
num_pages: 3 ,// total number of pages
data:[...]
}
The default page is one and the default number paer page is 12