Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

diet-router

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diet-router - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

10

index.js

@@ -5,3 +5,3 @@ function Router (...middleware) {

fn.path = path
fn.middleware = [...fn.middleware, ...middleware]
fn.middleware = [...middleware, ...fn.middleware]
for (const op of fn.queue) {

@@ -22,5 +22,11 @@ method.call(fn, op.method, op.path, op.middleware)

get: function (target, name) {
if (target.hasOwnProperty(name)) {
if (typeof name === 'symbol') {
return target[name]
}
if (name === 'inspect') {
return target.inspect
}
if (name in target) {
return target[name]
}
return function(path, ...middleware) {

@@ -27,0 +33,0 @@ method.call(this, name, path, middleware)

2

package.json
{
"name": "diet-router",
"version": "1.0.2",
"version": "1.0.3",
"description": "Simple, full featured, nestable router for diet.js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -63,2 +63,4 @@ # diet-router

Note that the router is the *last* argument passed
Alternatively:

@@ -71,3 +73,2 @@

Note that the router is the *last* argument passed using either method

@@ -108,1 +109,6 @@ ## Nested Routing ##

```
Contact
-------
Bug reports, feature requests, and questions are all welcome. Just open a GitHub issue and I'll
get back to you

@@ -35,2 +35,17 @@ const test = require('tape')

test('Expect to be able to console.log a router without breaking everything', function (t) {
try {
const router = Router()
console.log(router)
router.get('/', function ($) {
$.end('test success')
})
app.route('/test0', router)
t.pass('yes')
t.end()
} catch (err) {
ErrHandler(t)(err)
}
})
test('Expect router to add an accessible route when the router is called directly and when methods are called before the router', function (t) {

@@ -37,0 +52,0 @@ const router = Router()

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