@darkwolf/pagination.mjs

1.0.1 • Public • Published

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']

API Documentation

Contact Me

GitHub: @PavelWolfDark

Telegram: @PavelWolfDark

Email: PavelWolfDark@gmail.com

Package Sidebar

Install

npm i @darkwolf/pagination.mjs

Weekly Downloads

5

Version

1.0.1

License

MIT

Unpacked Size

34.4 kB

Total Files

10

Last publish

Collaborators

  • pavelwolfdark