koa-compose
Advanced tools
Comparing version 3.1.0 to 3.2.0
3.2.0 / 2016-10-25 | ||
================== | ||
* fix #60 infinite loop when calling next https://github.com/koajs/compose/pull/61 | ||
* add variadric support https://github.com/koajs/compose/pull/65 | ||
3.1.0 / 2016-03-17 | ||
@@ -3,0 +9,0 @@ ================== |
'use strict' | ||
const Promise = require('any-promise') | ||
const flatten = require('lodash/flatten') | ||
@@ -16,3 +17,3 @@ /** | ||
* | ||
* @param {Array} middleware | ||
* @param {Array|Function...} middleware | ||
* @return {Function} | ||
@@ -23,3 +24,3 @@ * @api public | ||
function compose (middleware) { | ||
if (!Array.isArray(middleware)) throw new TypeError('Middleware stack must be an array!') | ||
middleware = flatten(arguments) | ||
for (const fn of middleware) { | ||
@@ -42,3 +43,4 @@ if (typeof fn !== 'function') throw new TypeError('Middleware must be composed of functions!') | ||
index = i | ||
const fn = middleware[i] || next | ||
let fn = middleware[i] | ||
if (i === middleware.length) fn = next | ||
if (!fn) return Promise.resolve() | ||
@@ -45,0 +47,0 @@ try { |
@@ -5,3 +5,3 @@ { | ||
"repository": "koajs/compose", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"keywords": [ | ||
@@ -16,3 +16,4 @@ "koa", | ||
"dependencies": { | ||
"any-promise": "^1.1.0" | ||
"any-promise": "^1.1.0", | ||
"lodash": "^4.16.4" | ||
}, | ||
@@ -22,6 +23,6 @@ "devDependencies": { | ||
"istanbul": "^0.4.2", | ||
"matcha": "^0.6.1", | ||
"mocha": "^2.4.5", | ||
"matcha": "^0.7.0", | ||
"mocha": "^3.1.2", | ||
"should": "^2.0.0", | ||
"standard": "^6.0.8" | ||
"standard": "^8.4.0" | ||
}, | ||
@@ -28,0 +29,0 @@ "scripts": { |
@@ -31,5 +31,5 @@ | ||
[npm-url]: https://npmjs.org/package/koa-compose | ||
[travis-image]: https://img.shields.io/travis/koajs/compose/master.svg?style=flat-square | ||
[travis-image]: https://img.shields.io/travis/koajs/compose/next.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/koajs/compose | ||
[codecov-image]: https://img.shields.io/codecov/c/github/koajs/compose/master.svg?style=flat-square | ||
[codecov-image]: https://img.shields.io/codecov/c/github/koajs/compose/next.svg?style=flat-square | ||
[codecov-url]: https://codecov.io/github/koajs/compose | ||
@@ -36,0 +36,0 @@ [david-image]: http://img.shields.io/david/koajs/compose.svg?style=flat-square |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
4270
46
2
1
+ Addedlodash@^4.16.4
+ Addedlodash@4.17.21(transitive)