A tiny (760 bytes) pagination range creator.
$ yarn add pagr
import pagr from 'pagr';
pagr(4, 12, 5);
/** =>
[
{ page: 1, current: true, type: 'page' },
{ type: 'separator' },
{ page: 4, current: true, type: 'page' },
{ page: 5, current: false, type: 'page' },
{ page: 6, current: false, type: 'page' },
{ type: 'separator' },
{ page: 12, current: false, type: 'page' },
]
*/
- Type:
Number
- Required: ✅
The current index position of the paginator
- Type:
Number
- Required: ✅
The total page count of the paginator
- Type:
Number
- Required: ✅
The maximum count of displayed pages, not including separators.
page
: aNumber
denoting the page numbercurrent
: aboolean
denoting whether the page is the current pagetype
: a constant of page
type
: a constant of separator