pagelist
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Pagelist

Install

npm install pagelist
yarn add pagelist

Usage

import { pagelist } from 'pagelist';

const current = 1;
const total = 500;
const display = 9;

pagelist(current, total, display);
// => 1, 2, 3, 4, 5, 6, 7, _, 500

Examples

Current Total Display Result
1 1 10 [1]
1 10 10 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
2 10 10 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
1 1000 10 [1, 2, 3, 4, 5, 6, 7, 8, '-', 1000]
5 1000 10 [1, 2, 3, 4, 5, 6, 7, 8, '-', 1000]
6 1000 10 [1, '-', 4, 5, 6, 7, 8, 9, '-', 1000]
500 1000 7 [1, '-', 499, 500, 501, '-', 1000]
1000 1000 7 [1, '-', 996, 997, 998, 999, 1000
995 1000 7 [1, '-', 994, 995, 996, '-', 1000]

Readme

Keywords

none

Package Sidebar

Install

npm i pagelist

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

14.6 kB

Total Files

15

Last publish

Collaborators

  • deiucanta