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

regex-router

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regex-router - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

10

index.d.ts

@@ -35,4 +35,10 @@ import { IncomingMessage, ServerResponse } from 'http';

add(method: string, regExp: RegExp, handler: Handler): void;
/** Copied from http.METHODS, with special match-all ANY */
static HTTP_METHODS: string[];
any(regExp: RegExp, handler: Handler): void;
delete(regExp: RegExp, handler: Handler): void;
get(regExp: RegExp, handler: Handler): void;
head(regExp: RegExp, handler: Handler): void;
options(regExp: RegExp, handler: Handler): void;
patch(regExp: RegExp, handler: Handler): void;
post(regExp: RegExp, handler: Handler): void;
put(regExp: RegExp, handler: Handler): void;
}

43

index.js

@@ -36,8 +36,26 @@ var notFound = function (req, res) {

};
/** Copied from http.METHODS, with special match-all ANY */
Router.HTTP_METHODS = ['ANY',
'CHECKOUT', 'CONNECT', 'COPY', 'DELETE', 'GET', 'HEAD', 'LOCK', 'M-SEARCH',
'MERGE', 'MKACTIVITY', 'MKCOL', 'MOVE', 'NOTIFY', 'OPTIONS', 'PATCH', 'POST',
'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT', 'REPORT', 'SEARCH', 'SUBSCRIBE',
'TRACE', 'UNLOCK', 'UNSUBSCRIBE'];
Router.prototype.any = function (regExp, handler) {
this.routes.push({ method: 'ANY', regExp: regExp, handler: handler });
};
Router.prototype.delete = function (regExp, handler) {
this.routes.push({ method: 'DELETE', regExp: regExp, handler: handler });
};
Router.prototype.get = function (regExp, handler) {
this.routes.push({ method: 'GET', regExp: regExp, handler: handler });
};
Router.prototype.head = function (regExp, handler) {
this.routes.push({ method: 'HEAD', regExp: regExp, handler: handler });
};
Router.prototype.options = function (regExp, handler) {
this.routes.push({ method: 'OPTIONS', regExp: regExp, handler: handler });
};
Router.prototype.patch = function (regExp, handler) {
this.routes.push({ method: 'PATCH', regExp: regExp, handler: handler });
};
Router.prototype.post = function (regExp, handler) {
this.routes.push({ method: 'POST', regExp: regExp, handler: handler });
};
Router.prototype.put = function (regExp, handler) {
this.routes.push({ method: 'PUT', regExp: regExp, handler: handler });
};
return Router;

@@ -48,8 +66,11 @@ })();

/**
Add router.get(regExp, handler), router.GET(regExp, handler) shortcuts for
all official HTTP method names.
Add shortcuts for other official HTTP method names.
*/
Router.HTTP_METHODS.forEach(function (method) {
Router.prototype[method] = Router.prototype[method.toLowerCase()] =
function (url, func) { this.add(method, url, func); };
[
'CHECKOUT', 'CONNECT', 'COPY', 'LOCK', 'M-SEARCH', 'MERGE', 'MKACTIVITY',
'MKCOL', 'MOVE', 'NOTIFY', 'PROPFIND', 'PROPPATCH', 'PURGE', 'REPORT',
'SEARCH', 'SUBSCRIBE', 'TRACE', 'UNLOCK', 'UNSUBSCRIBE'
].forEach(function (method) {
Router.prototype[method.toLowerCase()] =
function (regExp, handler) { this.routes.push({ method: method, regExp: regExp, handler: handler }); };
});
{
"name": "regex-router",
"version": "1.1.0",
"version": "1.1.1",
"description": "Route http(s) requests via regular expressions",

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

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