New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

koa-trie-router

Package Overview
Dependencies
Maintainers
7
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-trie-router - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

12

lib/dispatcher.js

@@ -9,4 +9,5 @@ var Router = require('./router')

var node = match && match.node
// If no match, go to next middleware
if (notMatch(node)) return yield* next
// If no route match or no methods are defined, go to next middleware
// TODO: make node.methods more well-defined
if (!node || !node.methods) return yield* next

@@ -38,9 +39,2 @@ // If no HEAD middleware, default to GET.

function notMatch(node) {
if (!node) return true;
if (Object.keys(node.child).length) return true;
return false;
}
function* noop() {}

@@ -42,10 +42,7 @@

if (!paths.length) throw new Error('Route must have a path')
assert(paths.length, 'Route must have a path')
paths.forEach(function (path) {
if (typeof path !== 'string')
throw new TypeError('Paths must be strings: ' + path)
if (path !== '/' && path[0] !== '/')
throw new Error('Paths must start with a "/": ' + path)
assert(typeof path === 'string', 'Paths must be strings: ' + path)
assert(path[0] === '/', 'Paths must start with a "/": ' + path)
router.trie.define(path).forEach(function (node) {

@@ -56,3 +53,3 @@ if (!~nodes.indexOf(node)) nodes.push(node)

if (!nodes.length) throw new Error('No routes defined. Something went wrong.')
assert(nodes.length, 'No routes defined. Something went wrong.')
}

@@ -59,0 +56,0 @@

{
"name": "koa-trie-router",
"description": "Trie-routing for Koa",
"version": "1.0.9",
"version": "1.0.10",
"author": {

@@ -6,0 +6,0 @@ "name": "Jonathan Ong",

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