itty-router
Advanced tools
Comparing version 0.6.0 to 0.6.1
{ | ||
"name": "itty-router", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Tiny, zero-dependency router with route param and query parsing.", | ||
@@ -5,0 +5,0 @@ "main": "src/Router.js", |
@@ -89,8 +89,7 @@ ![image](https://user-images.githubusercontent.com/865416/79531114-fa0d8200-8036-11ea-824d-70d84164b00a.png) | ||
if (hit = path.match(route)) { | ||
return handler({ | ||
...req, | ||
return handler(Object.assign(req, { | ||
params: hit.groups, | ||
path, | ||
query: Object.fromEntries(searchParams.entries()) | ||
}) | ||
})) | ||
} | ||
@@ -100,3 +99,4 @@ } | ||
: (path, handler) => | ||
(obj[prop] = obj[prop] || []).push([path.replace(/(\/:([^\/\?]+)(\?)?)/gi, '/$3(?<$2>[^\/]+)$3'), handler]) && obj | ||
(obj[prop] = obj[prop] || []) | ||
.push([`^${path.replace('*', '.*').replace(/(\/:([^\/\?]+)(\?)?)/gi, '/$3(?<$2>[^\/]+)$3')}$`, handler]) && obj | ||
}) | ||
@@ -103,0 +103,0 @@ ``` |
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
9963