Skip to content

deptno/headless-paginator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

headless-paginator Build Status

npm

Install

npm install headless-paginator

API

  • first(): 1
  • last({total: number, limit: number}): number
  • next({total: number, limit: number, pos: number}): number
  • prev({pos: number}): number
  • range({total: number, limit: number, pos: number, range: number}): {start: number, end: number}

Arguments

total

items total count

limit

items on one page

pos

current page number(1 to n)

range

navigator range


example

{
    total: 81,
    limit: 10,
    pos: 7,
    range: 5
}

[1] [2] [3] [4] [5]


[6] [7] [8] [9]


range(...)
// {start: 6, end: 9}
next(...)
// 8
next(...)
// 9
next(...)
// 9
prev(...)
// 8
first()
// 1
last(...)
// 9

license

MIT