headless-paginator
v2.0.1
Published
pagination engine
Downloads
7
Maintainers
Readme
headless-paginator
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