Socket
Socket
Sign inDemoInstall

koa-router

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-router - npm Package Compare versions

Comparing version 5.2.2 to 5.2.3

4

history.md
# History
## 5.2.3
- Fix for middleware running twice when nesting routes [#184](https://github.com/alexmingoia/koa-router/issues/184)
## 5.2.2

@@ -4,0 +8,0 @@

25

lib/router.js

@@ -515,10 +515,7 @@ /**

stack.forEach(function (m, i) {
if (!added) {
var mNestingLevel = m.path.split('/').length;
var isParamRoute = !!m.paramNames.length;
if (routeNestingLevel === mNestingLevel && isParamRoute) {
stack.splice(i, 0, route);
added = true;
}
added = stack.some(function (m, i) {
var mNestingLevel = m.path.split('/').length;
var isParamRoute = !!m.paramNames.length;
if (routeNestingLevel === mNestingLevel && isParamRoute) {
return stack.splice(i, 0, route);
}

@@ -528,14 +525,12 @@ });

if (!added) {
stack.push(route);
}
if (!added) stack.push(route);
} else {
stack.forEach(function (m, i) {
stack.some(function (m, i) {
if (!m.methods.length && i === stack.length - 1) {
stack.push(route);
return stack.push(route);
} else if (m.methods.length) {
if (stack[i - 1]) {
stack.splice(i, 0, route);
return stack.splice(i, 0, route);
} else {
stack.unshift(route);
return stack.unshift(route);
}

@@ -542,0 +537,0 @@ }

@@ -13,3 +13,3 @@ {

"author": "Alex Mingoia <talk@alexmingoia.com>",
"version": "5.2.2",
"version": "5.2.3",
"keywords": [

@@ -16,0 +16,0 @@ "koa",

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