Package Exports
- @darkwolf/pagination.cjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@darkwolf/pagination.cjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Pagination
Install
ECMAScript (Node.js v12.x LTS or higher)
npm i --save @darkwolf/pagination.mjs
CommonJS (Node.js v10.x LTS or higher)
npm i --save @darkwolf/pagination.cjs
Using
// ECMAScript
import Pagination from '@darkwolf/pagination.mjs'
// CommonJS
const Pagination = require('@darkwolf/pagination.cjs')
Pagination.navigator({
hasFirstPage: true,
hasPreviousPage: true,
hasNextPage: true,
hasLastPage: true
}).map(button => button.text) // => ['«', '‹', '•', '›', '»']
const pagination = new Pagination({
pageCount: 100,
pageNumber: 20
})
pagination.paginator().map(button => button.text) // => ['«', '1…', '18', '19', '• 20 •', '21', '22', '23', '…100', '»']
pagination.paginator({
mode: 'navigation',
pageNumber: 10
}).map(button => button.text) // => ['« 1', '7', '8', '‹ 9', '• 10 •', '11 ›', '12', '13', '14', '100 »']
pagination.stepper().map(button => button.text) // => ['• 1 •', '5', '10', '25']