Socket
Socket
Sign inDemoInstall

itty-router

Package Overview
Dependencies
0
Maintainers
1
Versions
264
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.2 to 0.9.3

6

dist/itty-router.js

@@ -7,6 +7,4 @@ const Router = () =>

if (m = (u = new URL(c.url)).pathname.match(r)) { // r matched
Object.assign(c, {
params: m.groups,
query: Object.fromEntries(u.searchParams.entries()),
})
c.params = m.groups
c.query = Object.fromEntries(u.searchParams.entries())

@@ -13,0 +11,0 @@ for (h of hs) {

@@ -1,1 +0,1 @@

const e=()=>new Proxy({},{get:(e,s)=>"handle"===s?async s=>{for([r,hs]of e[(s.method||"GET").toLowerCase()]||[])if(m=(u=new URL(s.url)).pathname.match(r))for(h of(Object.assign(s,{params:m.groups,query:Object.fromEntries(u.searchParams.entries())}),hs))if(void 0!==(response=await h(s)))return response}:(r,...o)=>(e[s]=e[s]||[]).push([`^${r.replace("*",".*").replace(/(\/:([^\/\?]+)(\?)?)/gi,"/$3(?<$2>[^/]+)$3")}$`,o])&&e});module.exports={Router:e};
const e=()=>new Proxy({},{get:(e,o)=>"handle"===o?async o=>{for([r,hs]of e[(o.method||"GET").toLowerCase()]||[])if(m=(u=new URL(o.url)).pathname.match(r))for(h of(o.params=m.groups,o.query=Object.fromEntries(u.searchParams.entries()),hs))if(void 0!==(response=await h(o)))return response}:(r,...s)=>(e[o]=e[o]||[]).push([`^${r.replace("*",".*").replace(/(\/:([^\/\?]+)(\?)?)/gi,"/$3(?<$2>[^/]+)$3")}$`,s])&&e});module.exports={Router:e};
{
"name": "itty-router",
"version": "0.9.2",
"version": "0.9.3",
"description": "Tiny, zero-dependency router with route param and query parsing.",

@@ -5,0 +5,0 @@ "main": "dist/itty-router.min.js",

@@ -160,6 +160,4 @@ ![image](https://user-images.githubusercontent.com/865416/79531114-fa0d8200-8036-11ea-824d-70d84164b00a.png)

if (m = (u = new URL(c.url)).pathname.match(r)) { // r matched
Object.assign(c, {
params: m.groups,
query: Object.fromEntries(u.searchParams.entries()),
})
c.params = m.groups
c.query = Object.fromEntries(u.searchParams.entries())

@@ -173,3 +171,8 @@ for (h of hs) {

: (p, ...hs) =>
(o[k] = o[k] || []).push([`^${p.replace('*', '.*').replace(/(\/:([^\/\?]+)(\?)?)/gi, '/$3(?<$2>[^/]+)$3')}$`, hs]) && o
(o[k] = o[k] || []).push([
`^${p
.replace('*', '.*')
.replace(/(\/:([^\/\?]+)(\?)?)/gi, '/$3(?<$2>[^/]+)$3')}$`,
hs,
]) && o,
}

@@ -176,0 +179,0 @@ )

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc