Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zbinlin/pagination-generator
https://github.com/zbinlin/pagination-generator
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/zbinlin/pagination-generator
- Owner: zbinlin
- Created: 2016-03-23T12:46:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-03-27T14:09:30.000Z (over 8 years ago)
- Last Synced: 2024-10-11T22:13:24.524Z (about 1 month ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pagination generator
**[DEMO](https://live-demo.github.io/pagen/dist/index.html)**
## Install
```shell
npm install pagination-generator
```## Usage
```js
const pagen = require("pagination-generator");
console.log(pagen(4, 1000, 9)); // current = 4, count = 1000, limit = 9;
/* returns:
[ { type: 'nav', name: 'first', value: 1, disabled: false },
{ type: 'nav', name: 'prev', value: 3, disabled: false },
{ type: 'num', name: 2, value: 2, current: false },
{ type: 'num', name: 3, value: 3, current: false },
{ type: 'num', name: 4, value: 4, current: true },
{ type: 'num', name: 5, value: 5, current: false },
{ type: 'num', name: 6, value: 6, current: false },
{ type: 'nav', name: 'next', value: 5, disabled: false },
{ type: 'nav', name: 'last', value: 1000, disabled: false } ]
*/
```