itty-router
Advanced tools
Comparing version 2.0.7 to 2.1.0
## Changelog | ||
Until this library makes it to a production release of v1.x, **minor versions may contain breaking changes to the API**. After v1.x, semantic versioning will be honored, and breaking changes will only occur under the umbrella of a major version bump. | ||
- **v2.1.0** - now handles the problematic . character within a param (e.g. /:url/action with /google.com/action) | ||
- **v2.0.7** - shaved a few more characters in the regex | ||
@@ -5,0 +6,0 @@ - **v2.0.0** - API break: `Router({ else: missingHandler })` has been replaced with `router.all('*', missingHandler)`, and now "all" channel respects order of entry |
@@ -21,3 +21,3 @@ const Router = (o = {}) => | ||
.replace(/\/$/, '') | ||
.replace(/:(\w+)(\?)?/g, '$2(?<$1>[^/\.]+)$2') | ||
.replace(/:(\w+)(\?)?(\.)?/g, '$2(?<$1>[^/$3]+)$2$3') | ||
}\/*$`, | ||
@@ -24,0 +24,0 @@ hs, |
@@ -1,1 +0,1 @@ | ||
const e=(e={})=>new Proxy(e,{get:(e,r,a)=>"handle"===r?async(r,...a)=>{for([p,hs]of e.r.filter((e=>e[2]===r.method||"ALL"===e[2])))if(m=(u=new URL(r.url)).pathname.match(p))for(h of(r.params=m.groups,r.query=Object.fromEntries(u.searchParams.entries()),hs))if(void 0!==(s=await h(r,...a)))return s}:(s,...o)=>(e.r=e.r||[]).push([`^${(e.base||"")+s.replace(/(\/?)\*/g,"($1.*)?").replace(/\/$/,"").replace(/:(\w+)(\?)?/g,"$2(?<$1>[^/.]+)$2")}/*$`,o,r.toUpperCase()])&&a});module.exports={Router:e}; | ||
const e=(e={})=>new Proxy(e,{get:(e,r,a)=>"handle"===r?async(r,...a)=>{for([p,hs]of e.r.filter((e=>e[2]===r.method||"ALL"===e[2])))if(m=(u=new URL(r.url)).pathname.match(p))for(h of(r.params=m.groups,r.query=Object.fromEntries(u.searchParams.entries()),hs))if(void 0!==(s=await h(r,...a)))return s}:(s,...o)=>(e.r=e.r||[]).push([`^${(e.base||"")+s.replace(/(\/?)\*/g,"($1.*)?").replace(/\/$/,"").replace(/:(\w+)(\?)?(\.)?/g,"$2(?<$1>[^/$3]+)$2$3")}/*$`,o,r.toUpperCase()])&&a});module.exports={Router:e}; |
{ | ||
"name": "itty-router", | ||
"version": "2.0.7", | ||
"version": "2.1.0", | ||
"description": "Tiny, zero-dependency router with route param and query parsing.", | ||
@@ -22,3 +22,9 @@ "main": "./dist/itty-router.min.js", | ||
"handler", | ||
"params" | ||
"params", | ||
"middleware", | ||
"nested", | ||
"rest", | ||
"crud", | ||
"query", | ||
"paramaters" | ||
], | ||
@@ -25,0 +31,0 @@ "scripts": { |
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
17227