koa-pagination
Advanced tools
Comparing version 0.2.0 to 0.3.0
## Changelog | ||
### 0.3.0 / 2015-02-09 | ||
- [#20](https://github.com/seegno/koa-pagination/pull/20) Change default unit to `items` (@fixe) | ||
- [#19](https://github.com/seegno/koa-pagination/pull/19) Allow specifying `unit` option (@fixe) | ||
### 0.2.0 / 2015-02-03 | ||
@@ -4,0 +8,0 @@ - [#18](https://github.com/seegno/koa-pagination/pull/18) Update response status (@franciscocardoso) |
@@ -19,3 +19,4 @@ | ||
options = _.assign({ | ||
maximum: 50 | ||
maximum: 50, | ||
unit: 'items' | ||
}, options); | ||
@@ -27,3 +28,3 @@ | ||
var maximum = options.maximum; | ||
var unit = 'bytes'; | ||
var unit = options.unit; | ||
@@ -30,0 +31,0 @@ // Prevent invalid `maximum` value configuration. |
{ | ||
"name": "koa-pagination", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Koa Pagination", | ||
@@ -33,3 +33,3 @@ "main": "index.js", | ||
"changelog": "./node_modules/.bin/github-changes -o seegno -r koa-pagination -a --only-pulls --use-commit-body --title 'Changelog' --date-format '/ YYYY-MM-DD'", | ||
"test": "NODE_ENV=test ./node_modules/.bin/mocha --harmony-generators test/*_test.js" | ||
"test": "NODE_ENV=test ./node_modules/.bin/mocha --harmony test/*_test.js" | ||
}, | ||
@@ -36,0 +36,0 @@ "author": "Seegno", |
@@ -20,3 +20,4 @@ # Koa Pagination | ||
The middleware can be configured with the following parameters: | ||
- Maximum: Maximum number of items allowed per page (50 items by default). | ||
- Maximum: Maximum number of items allowed per page (`50` by default). | ||
- Unit: Range unit to be used when no `Range` header is provided (`items` by default). | ||
@@ -27,3 +28,4 @@ You can change the defaults by doing: | ||
paginate({ | ||
maximum: 100 | ||
maximum: 100, | ||
unit: 'bytes' | ||
}); | ||
@@ -30,0 +32,0 @@ ``` |
@@ -53,3 +53,3 @@ | ||
.get('/') | ||
.expect('Content-Range', 'bytes 0-49/*') | ||
.expect('Content-Range', 'items 0-49/*') | ||
.end(); | ||
@@ -65,3 +65,3 @@ }); | ||
.get('/') | ||
.expect('Content-Range', 'bytes 0-2/*') | ||
.expect('Content-Range', 'items 0-2/*') | ||
.end(); | ||
@@ -134,3 +134,3 @@ }); | ||
.get('/') | ||
.set('Range', 'bytes=5-1') | ||
.set('Range', 'items=5-1') | ||
.expect(416, 'Range Not Satisfiable') | ||
@@ -269,3 +269,3 @@ .end(); | ||
app.use(paginate()); | ||
app.use(paginate({ unit: 'bytes' })); | ||
@@ -272,0 +272,0 @@ app.use(function *() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17529
333
86