Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

itty-router

Package Overview
Dependencies
Maintainers
2
Versions
265
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

itty-router - npm Package Compare versions

Comparing version 2.0.7 to 2.1.0

1

CHANGELOG.md
## 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

2

dist/itty-router.js

@@ -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": {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc