Socket
Socket
Sign inDemoInstall

itty-router

Package Overview
Dependencies
Maintainers
1
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 1.2.1 to 1.2.2

4

dist/itty-router.js
const Router = (o = {}) =>
new Proxy(o, {
get: (t, k, receiver) => k === 'handle'
get: (t, k, c) => k === 'handle'
? async q => {

@@ -23,5 +23,5 @@ for ([p, hs] of t[(q.method || 'GET').toLowerCase()] || []) {

hs
]) && receiver
]) && c
})
module.exports = { Router }
{
"name": "itty-router",
"version": "1.2.1",
"version": "1.2.2",
"description": "Tiny, zero-dependency router with route param and query parsing.",

@@ -22,6 +22,6 @@ "main": "dist/itty-router.min.js",

"test": "jest --verbose --coverage",
"verify": "yarn build && yarn test",
"verify": "echo 'verifying module...' && yarn build && yarn test",
"dev": "yarn test - --watch",
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls",
"prerelease": "echo releasing... && yarn build",
"prerelease": "yarn verify",
"prebuild": "rimraf dist && mkdir dist && node prebuild.js",

@@ -28,0 +28,0 @@ "build": "terser -c -m toplevel -- dist/itty-router.js > dist/itty-router.min.js",

![image](https://user-images.githubusercontent.com/865416/79531114-fa0d8200-8036-11ea-824d-70d84164b00a.png)
[![minified + gzipped size](https://badgen.net/bundlephobia/minzip/itty-router@latest)](https://bundlephobia.com/result?p=itty-router)
[![Build Status via Travis CI](https://travis-ci.org/kwhitley/itty-router.svg?branch=v0.x)](https://travis-ci.org/kwhitley/itty-router)
[![Coverage Status](https://coveralls.io/repos/github/kwhitley/itty-router/badge.svg?branch=pr/travis-fix)](https://coveralls.io/github/kwhitley/itty-router?branch=v0.x)
[![Build Status via Travis CI](https://travis-ci.org/kwhitley/itty-router.svg?branch=v1.x)](https://travis-ci.org/kwhitley/itty-router)
[![Coverage Status](https://coveralls.io/repos/github/kwhitley/itty-router/badge.svg?branch=v1.x)](https://coveralls.io/github/kwhitley/itty-router?branch=v1.x)

@@ -190,8 +190,8 @@ It's an itty bitty router. Like... super tiny, with zero dependencies. For reals.

## Entire Router Code (latest...)
## The Entire Code (for more legibility, [see src on GitHub](https://github.com/kwhitley/itty-router/blob/v1.x/src/itty-router.js))
```js
const Router = (o = {}) =>
new Proxy({}, {
get: (t, k) => k === 'handle'
? async (q) => {
new Proxy(o, {
get: (t, k, c) => k === 'handle'
? async q => {
for ([p, hs] of t[(q.method || 'GET').toLowerCase()] || []) {

@@ -212,6 +212,6 @@ if (m = (u = new URL(q.url)).pathname.match(p)) {

.replace(/(\/?)\*/g, '($1.*)?')
.replace(/(\/:([^\/\?]+)(\?)?)/gi, '/$3(?<$2>[^/]+)$3')
.replace(/(\/:([^\/\?]+)(\?)?)/g, '/$3(?<$2>[^/]+)$3')
}$`,
hs
]) && t
]) && c
})

@@ -230,2 +230,3 @@ ```

- **v1.2.2** - fix: require verify/build pass before publishing and fixed README badges (should point to v1.x branch)
- **v1.2.0** - feature: chainable route declarations (with test)... that didn't take long...

@@ -232,0 +233,0 @@ - **v1.1.1** - updated README to reflect that chaining actually never was working... (not a breaking change, as no code could have been using it)

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