can-route
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "can-route", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A simple regexp router that runs inside a `http.createServer` handler and returns false when it can’t route a request.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -25,6 +25,7 @@ var named = require('named-regexp').named | ||
Can.prototype.route = function(req, res) { | ||
var hash = !server && res === true | ||
var pathname = (typeof req == 'string' ? | ||
req : null | ||
(!hash ? req.replace(/(\?|#).+$/, '') : req ) : | ||
null | ||
) | ||
var method = (server ? | ||
@@ -34,4 +35,2 @@ req.method.toLowerCase() : 'get' | ||
var hash = !server && res === true | ||
if (!pathname) { | ||
@@ -38,0 +37,0 @@ var href = req.url || req.href |
@@ -29,5 +29,5 @@ var run = require('tape').test | ||
window.onhashchange = function() { | ||
window.onhashchange = null | ||
test.ok(can.route(location, true), 'can route') | ||
test.deepEqual(result, expected) | ||
window.onhashchange = null | ||
test.end() | ||
@@ -44,5 +44,5 @@ } | ||
window.onhashchange = function() { | ||
window.onhashchange = null | ||
test.ok(can.route(location, true), 'can route') | ||
test.deepEqual(result, expected) | ||
window.onhashchange = null | ||
test.end() | ||
@@ -60,5 +60,5 @@ } | ||
window.onhashchange = function() { | ||
window.onhashchange = null | ||
test.ok(can.route(location, true), 'can route') | ||
test.deepEqual(result, expected) | ||
window.onhashchange = null | ||
test.end() | ||
@@ -74,2 +74,3 @@ } | ||
window.onhashchange = function() { | ||
window.onhashchange = null | ||
test.ok(!can.route(location), 'indeed') | ||
@@ -76,0 +77,0 @@ test.end() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8965
241