# bookshelf-simplepaginate

> A simple bookshelfjs pagination based on Laravels simplePaginate.

Latest version **0.0.2** (published 2018-03-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install bookshelf-simplepaginate
pnpm add bookshelf-simplepaginate
yarn add bookshelf-simplepaginate
bun add bookshelf-simplepaginate
```

## 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.0.2 |
| Published | 2018-03-01 |
| First published | 2018-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | asked_io |
| Maintainers | gcphost |
| Keywords | bookshelf, paginate, pagination, simplepaginate, simplepagination |

## Links

- npm: https://www.npmjs.com/package/bookshelf-simplepaginate
- Repository: https://github.com/Askedio/bookshelf-simplepaginate
- Homepage: https://github.com/Askedio/bookshelf-simplepaginate#readme
- Issues: https://github.com/Askedio/bookshelf-simplepaginate/issues
- npm.io page: https://npm.io/package/bookshelf-simplepaginate

## Recent versions

- 0.0.2 (latest) — 2018-03-01
- 0.0.1 — 2018-02-22

## README

# bookshelf-simplepaginate
This [Bookshelf.js](https://github.com/tgriesser/bookshelf) plugin provides a Laravel like simple pagination to your models.

## Installation

Install the package via `npm`:

```sh
$ npm install --save bookshelf-simplepaginate
```

## Usage
```js
var bookshelf = require('bookshelf')(knex);

bookshelf.plugin(require('bookshelf-simplepaginate'));
```

```js
Car.query(function (qb) {
    qb.innerJoin('manufacturers', 'cars.manufacturer_id', 'manufacturers.id');
    qb.groupBy('cars.id');
    qb.where('manufacturers.country', '=', 'Sweden');
}).simplePaginate({
    limit: 15, // Defaults to 10 if not specified
    page: 3, // Defaults to 1 if not specified
    withRelated: ['engine'] // Passed to Model#fetchAll
}).then(function (results) {
    console.log(results); 
});
```

Output of results: 
```json
{
   "data": [],
   "meta": {
      "pagination": {
         "count": 53,
         "per_page": 15,
         "current_page": 1,
         "links": {
            "previous": null,
            "next": 1
         }
      }
   }
}
```

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