Socket
Socket
Sign inDemoInstall

koa-compose

Package Overview
Dependencies
Maintainers
9
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-compose - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

6

History.md
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 @@ ==================

8

index.js
'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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc