koa-pagination
Advanced tools
Comparing version 2.0.0 to 2.0.1
# Changelog | ||
## [v2.0.1](https://github.com/seegno/koa-pagination/tree/v2.0.1) (2016-05-18) | ||
[Full Changelog](https://github.com/seegno/koa-pagination/compare/v2.0.0...v2.0.1) | ||
**Merged pull requests:** | ||
- Update range-specifier-parser@1.0.2 [\#35](https://github.com/seegno/koa-pagination/pull/35) ([nunofgs](https://github.com/nunofgs)) | ||
- Add asterisk instructions to readme [\#34](https://github.com/seegno/koa-pagination/pull/34) ([nunofgs](https://github.com/nunofgs)) | ||
## [v2.0.0](https://github.com/seegno/koa-pagination/tree/v2.0.0) (2016-05-18) | ||
@@ -4,0 +12,0 @@ [Full Changelog](https://github.com/seegno/koa-pagination/compare/v1.1.1...v2.0.0) |
{ | ||
"name": "koa-pagination", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Koa Pagination", | ||
@@ -21,3 +21,3 @@ "license": "MIT", | ||
"is-safe-integer": "1.0.1", | ||
"range-specifier-parser": "v1.0.0", | ||
"range-specifier-parser": "v1.0.2", | ||
"standard-http-error": "2.0.0", | ||
@@ -24,0 +24,0 @@ "util": "0.10.3" |
# Koa Pagination | ||
[![npm version][npm-image]][npm-url] | ||
[![build status][travis-image]][travis-url] | ||
[![Code Climate][codeclimate-gpa-image]][codeclimate-url] | ||
[![Test Coverage][codeclimate-coverage-image]][codeclimate-url] | ||
[![npm version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Code Climate][codeclimate-gpa-image]][codeclimate-url] [![Test Coverage][codeclimate-coverage-image]][codeclimate-url] | ||
@@ -12,10 +9,8 @@ Koa Pagination is a middleware to handle [Range Pagination Headers](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) using `Range` & `Content-Range` entity-headers. | ||
Choose your preferred method: | ||
`npm install --save koa-pagination` | ||
* npm: `npm install --save koa-pagination` | ||
* Download: [koa-pagination](https://github.com/seegno/koa-pagination) | ||
### Configuration | ||
The middleware can be configured with the following parameters: | ||
- Maximum: Maximum number of items allowed per page (`50` by default). | ||
@@ -26,3 +21,3 @@ - Unit: Range unit to be used when no `Range` header is provided (`items` by default). | ||
```js | ||
```javascript | ||
paginate({ | ||
@@ -33,5 +28,6 @@ maximum: 100, | ||
``` | ||
## Usage | ||
```js | ||
```javascript | ||
import koa from 'koa'; | ||
@@ -62,11 +58,17 @@ import paginate from 'koa-pagination'; | ||
```js | ||
```javascript | ||
'Range: items=0-4' | ||
``` | ||
You can also provide `*` at the end of the range in order to retrieve the all of the available items: | ||
```javascript | ||
'Range: items=0-*' | ||
``` | ||
### Response | ||
This will generate a response with the following `Content-Range` header: | ||
The first example will generate a response with the following `Content-Range` header: | ||
```js | ||
```javascript | ||
'Content-Range: items 0-4/*' | ||
@@ -90,4 +92,8 @@ ``` | ||
## License | ||
MIT | ||
[codeclimate-coverage-image]: https://img.shields.io/codeclimate/coverage/github/seegno/koa-pagination.svg?style=flat-square | ||
[codeclimate-gpa-image]: https://img.shields.io/codeclimate/github/seegno/koa-pagination.svg?style=flat-square | ||
[codeclimate-url]: https://codeclimate.com/github/seegno/koa-pagination | ||
[npm-image]: https://img.shields.io/npm/v/koa-pagination.svg?style=flat-square | ||
@@ -97,4 +103,1 @@ [npm-url]: https://npmjs.org/package/koa-pagination | ||
[travis-url]: https://travis-ci.org/seegno/koa-pagination | ||
[codeclimate-coverage-image]: https://img.shields.io/codeclimate/coverage/github/seegno/koa-pagination.svg?style=flat-square | ||
[codeclimate-gpa-image]: https://img.shields.io/codeclimate/github/seegno/koa-pagination.svg?style=flat-square | ||
[codeclimate-url]: https://codeclimate.com/github/seegno/koa-pagination |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
28419
98
3