find-my-way
Advanced tools
Comparing version 1.3.1 to 1.3.2
44
index.js
@@ -176,3 +176,3 @@ 'use strict' | ||
var handle = currentNode.getHandler(method) | ||
if (handle === null) break | ||
if (!handle) return null | ||
@@ -209,16 +209,24 @@ var paramNames = handle.params | ||
currentNode = node | ||
} else if (kind === 1) { // parametric route | ||
continue | ||
} | ||
// parametric route | ||
if (kind === 1) { | ||
currentNode = node | ||
i = 0 | ||
for (; i < pathLen && path.charCodeAt(i) !== 47; i++) {} | ||
decoded = fastDecode(path.substring(0, i)) | ||
while (i < pathLen && path.charCodeAt(i) !== 47) i++ | ||
decoded = fastDecode(path.slice(0, i)) | ||
if (errored) { | ||
break | ||
return null | ||
} | ||
params[pindex++] = decoded | ||
path = path.substring(i) | ||
} else if (kind === 2) { // wildcard route | ||
path = path.slice(i) | ||
continue | ||
} | ||
// wildcard route | ||
if (kind === 2) { | ||
decoded = fastDecode(path) | ||
if (errored) { | ||
break | ||
return null | ||
} | ||
@@ -228,17 +236,23 @@ params[pindex] = decoded | ||
path = '' | ||
} else if (kind === 3) { // parametric(regex) route | ||
continue | ||
} | ||
// parametric(regex) route | ||
if (kind === 3) { | ||
currentNode = node | ||
i = 0 | ||
for (; i < pathLen && path.charCodeAt(i) !== 47; i++) {} | ||
while (i < pathLen && path.charCodeAt(i) !== 47) i++ | ||
decoded = fastDecode(path.slice(0, i)) | ||
if (errored) { | ||
break | ||
return null | ||
} | ||
if (!node.regex.test(decoded)) break | ||
if (!node.regex.test(decoded)) return | ||
params[pindex++] = decoded | ||
path = path.slice(i) | ||
} else if (len !== prefixLen) break // route not found | ||
continue | ||
} | ||
// route not found | ||
if (len !== prefixLen) return null | ||
} | ||
return null | ||
} | ||
@@ -245,0 +259,0 @@ |
{ | ||
"name": "find-my-way", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Crazy fast http radix based router", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
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
41035
1146
3