Socket
Socket
Sign inDemoInstall

routes

Package Overview
Dependencies
0
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.2.0

15

index.js

@@ -123,3 +123,3 @@

if (!path) throw new Error(' route requires a path');
if (!fn) throw new Error(' route ' + src + ' requires a callback');
if (!fn) throw new Error(' route ' + path.toString() + ' requires a callback');

@@ -143,7 +143,8 @@ var route = Route(path);

module.exports = {
Route: Route,
pathToRegExp: pathToRegExp,
match: match,
Router: Router
}
Router.Route = Route
Router.pathToRegExp = pathToRegExp
Router.match = match
// back compat
Router.Router = Router
module.exports = Router
{
"name": "routes",
"description": "Minimalist route matching for javascript",
"version": "0.1.1",
"version": "0.2.0",
"homepage": "https://github.com/aaronblohowiak/routes.js",

@@ -6,0 +6,0 @@ "repository": "https://github.com/aaronblohowiak/routes.js.git",

@@ -17,3 +17,4 @@ # Routes.js

var router = new require('routes').Router();
var Router = require('routes');
var router = Router();
var noop = function(){};

@@ -20,0 +21,0 @@

@@ -1,2 +0,3 @@

var router = new require('../index').Router();
var Router = require("../index");
var router = Router();

@@ -3,0 +4,0 @@ var noop = function(){};

var assert = require("assert"),
routes = require("../index"),
router = new routes.Router();
Router = require("../index"),
router = Router();

@@ -167,3 +167,3 @@ (function(){

//save typing in fixtures
fixture.route = test.path;
fixture.route = test.path.toString(); // match gets string, so ensure same type
deepEqual(match, fixture);

@@ -180,2 +180,23 @@ assertCount++;

console.log(assertCount.toString()+ " assertions made succesfully");
//test exceptions
assert.throws(
function() {
router.addRoute();
}
, /route requires a path/
, "expected 'route requires a path' error"
);
assertCount++;
assert.throws(
function() {
router.addRoute('/');
}
, /route \/ requires a callback/
, "expected 'route requries a callback' error"
);
assertCount++;
console.log(assertCount.toString()+ " assertions made succesfully");
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc