@felix-ongom/js-paginator

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @felix-ongom/js-paginator

Weekly Downloads

3

Version

1.0.0

License

ISC

Unpacked Size

1.79 kB

Total Files

3

Last publish

Collaborators

  • felix-ongom