pagination-info

0.5.1 • Public • Published

calculate pagination infomation according to total records ,pagesize, and current page number

the core function :

function calculatePaginationInfo(totalRecords=10,pageSize=10,currentPage=1,semiBandWidth=5)

return a object:

{
    totalRecords,
    totalPages,
    current:currentPage,
    pageSize,
    semiBandWidth,
    firstPage:1,
    lastPage:lastPage,
    previous:previousPage,
    next:nextPage,
    firstDigit,
    lastDigit,
    arraySize, 
    array,          // array of page number : [firstDigit,LastDigit]
    shouldDisply,   // should dispaly pagination ( when the length of array is less than 2 )
}

Readme

Keywords

Package Sidebar

Install

npm i pagination-info

Weekly Downloads

3

Version

0.5.1

License

ISC

Last publish

Collaborators

  • webbot