# simple-pager

> Simple pager for node.js

Latest version **0.1.1** (published 2015-08-26) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install simple-pager
pnpm add simple-pager
yarn add simple-pager
bun add simple-pager
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2015-08-26 |
| First published | 2015-08-26 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | intenter |
| Maintainers | intenter |
| Keywords | nodejs, javascript, pager, paging, pagination |

## Links

- npm: https://www.npmjs.com/package/simple-pager
- Repository: https://github.com/intenter/simple-pager
- Issues: https://github.com/intenter/simple-pager/issues
- npm.io page: https://npm.io/package/simple-pager

## Recent versions

- 0.1.1 (latest) — 2015-08-26

## README

# simple-pager
simple-pager is the small and simple pager library for node. It doesn't do any rendering instead it generates data model
you can use in any way in your with your template engine or with any other tools.

## Installation

```bash
npm install simple-pager
```

## Usage
```js
var pager = require('simple-pager');
var pagesModel = pager.getPagesModel(4, 10);
```
The pagesModel will look like this:
```js
[
  { page: 3 },
  { page: 4, current: true },
  { page: 5 }
]
```

The first page number is 1. Zero page is considered to be out of the valid pages range.

In fact getPagesModel is the only method exposed by the module:
```js
  getPagesModel(currentPage, totalPages [, options])
```
If you don't pass any options by default this method generates a list with the current page and couple of surrounding pages.
Current page marked by the corresponding boolean property. 
Here is the full set of the available options with default values:
```js
{
  surroundWith: 1, 
  outputFirst: false, 
  outputLast: false
}
```
* `surroundWith` - number of pages to output before and after the current
* `outputFirst` - whether the first page should be present in the result array
* `outputLast` - whether the last page should be present in the result array

---
_Source: https://npm.io/package/simple-pager · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
