find-my-way
Advanced tools
Comparing version 1.2.0 to 1.2.1
23
index.js
@@ -20,2 +20,3 @@ 'use strict' | ||
const httpMethods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT', 'OPTIONS', 'TRACE', 'CONNECT'] | ||
var errored = false | ||
@@ -151,2 +152,3 @@ function Router (opts) { | ||
var node = null | ||
var decoded = null | ||
var pindex = 0 | ||
@@ -204,7 +206,7 @@ var params = [] | ||
while (i < pathLen && path.charCodeAt(i) !== 47) i++ | ||
try { | ||
params[pindex++] = decodeURIComponent(path.slice(0, i)) | ||
} catch (e) { | ||
decoded = fastDecode(path.slice(0, i)) | ||
if (errored) { | ||
return null | ||
} | ||
params[pindex++] = decoded | ||
path = path.slice(i) | ||
@@ -217,7 +219,7 @@ continue | ||
if (node) { | ||
try { | ||
params[pindex] = decodeURIComponent(path) | ||
} catch (e) { | ||
decoded = fastDecode(path) | ||
if (errored) { | ||
return null | ||
} | ||
params[pindex] = decoded | ||
currentNode = node | ||
@@ -293,1 +295,10 @@ path = '' | ||
} | ||
function fastDecode (path) { | ||
errored = false | ||
try { | ||
return decodeURIComponent(path) | ||
} catch (err) { | ||
errored = true | ||
} | ||
} |
{ | ||
"name": "find-my-way", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"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
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
37363
1022