Socket
Socket
Sign inDemoInstall

router

Package Overview
Dependencies
Maintainers
2
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

router - npm Package Compare versions

Comparing version 0.5.4 to 0.5.5

12

examples/index.js
var router = require('router');
var server = router();

@@ -18,13 +17,2 @@

var ns = server.namespace('ns');
ns.get('/', function(req, res) {
res.writeHead(200);
res.end('i am ns root');
});
ns.all(function(req, res) {
res.writeHead(200);
res.end('olla from namespace');
});
server.all(function(req, res) {

@@ -31,0 +19,0 @@ res.writeHead(200);

10

index.js

@@ -104,3 +104,3 @@ var http = require('http');

this.removeListener('request', this.route);
return this.route;

@@ -185,11 +185,3 @@ };

};
Router.prototype.namespace = Router.prototype.prefix = function(prefix) {
var router = new Router();
prefix = '/'+prefix.replace(/^\//, '').replace(/\/$/, '');
this.all(prefix+'/*', '/{*}', router.route).all(prefix, '/', router.route);
return router;
};
Router.prototype._find = function(request, response) {

@@ -196,0 +188,0 @@ var method = request.method;

9

lib/matcher.js

@@ -0,1 +1,9 @@

var decode = function(str) {
try {
return decodeURIComponent(str);
} catch(err) {
return str;
}
};
module.exports = function(pattern) {

@@ -33,2 +41,3 @@ if (typeof pattern !== 'string') { // regex

param = decode(param);
map[k] = map[k] ? [].concat(map[k]).concat(param) : param;

@@ -35,0 +44,0 @@ });

{
"name":"router",
"version":"0.5.4",
"version":"0.5.5",
"description":"A lean and mean web router",

@@ -5,0 +5,0 @@ "contributors": [

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