Hey 👋, this is a gist which stores the final bundle results of the bundlejs api, learn more on the website https://bundlejs.com. This is the result of https://deno.bundlejs.com/?q=itty-router@next/Router&badge&badge-style=flat-square.
Created
March 22, 2023 06:13
-
-
Save bundle-js/19ff88b27c7c724f7dd9977f05972e39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var u=({base:f="",routes:l=[]}={})=>({__proto__:new Proxy({},{get:(e,s,o)=>(a,...t)=>l.push([s.toUpperCase(),RegExp(`^${(f+"/"+a).replace(/\/+(\/|$)/g,"$1").replace(/(\/?\.?):(\w+)\+/g,"($1(?<$2>*))").replace(/(\/?\.?):(\w+)/g,"($1(?<$2>[^$1/]+?))").replace(/\./g,"\\.").replace(/(\/?)\*/g,"($1.*)?")}/*$`),t])&&o}),routes:l,async handle(e,...s){let o,a,t=new URL(e.url),$=e.query={};for(let[r,p]of t.searchParams)$[r]=$[r]===void 0?p:[$[r],p].flat();for(let[r,p,c]of l)if((r===e.method||r==="ALL")&&(a=t.pathname.match(p))){e.params=a.groups||{};for(let g of c)if((o=await g(e.proxy||e,...s))!==void 0)return o}}});export{u as Router}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment