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

dispatch

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

dispatch - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

lib/dispatch.js

@@ -37,3 +37,3 @@ var url = require('url');

var pattern = url[0].replace(/\/:\w+/g, '(?:/([^\/]+))');
url[0] = new RegExp('^' + pattern + '$');
url[0] = new RegExp('^(?:' + pattern + ')$');
return url;

@@ -40,0 +40,0 @@ });

@@ -6,3 +6,3 @@ {

"author": "Caolan McMahon",
"version": "1.0.1",
"version": "1.0.2",
"repository": {

@@ -9,0 +9,0 @@ "type": "git",

@@ -288,1 +288,24 @@ var dispatch = require('../lib/dispatch');

exports['regexp with pipe'] = function (test) {
test.expect(2);
var requestFactory = function(url){ return {url: url, method: 'GET'}; };
var called = function(req, res){
test.ok(true);
};
var notCalled = function(req, res){
test.ok(false, 'should not be called');
};
dispatch({
'/x|/y': called
})(requestFactory('/x'), 'response');
dispatch({
'/x|/y': called
})(requestFactory('/y'), 'response');
dispatch({
'/x|/y': notCalled
})(requestFactory('/xx'), 'response');
dispatch({
'/x|/y': notCalled
})(requestFactory('/yy'), 'response');
test.done();
};
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