routes
Advanced tools
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"); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
12265
325
116
1