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

microrouter

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microrouter - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

.babelrc

5

lib/index.js

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

const UrlPattern = require('url-pattern')
const { getParamsAndQuery } = require('../utils')

@@ -9,4 +10,6 @@

const route = new UrlPattern(path)
return (req, res) => {
const { params, query } = getParamsAndQuery(path, req.url)
const { params, query } = getParamsAndQuery(route, req.url)

@@ -13,0 +16,0 @@ if (params && req.method === method) {

10

package.json
{
"name": "microrouter",
"description": "🚉 A tiny and functional router for Zeit's Micro",
"version": "2.1.0",
"main": "lib/index.js",
"version": "2.1.1",
"main": "dist/index.js",
"jsnext:main": "lib/index.js",
"scripts": {
"build": "rm -rf dist/* && babel lib --ignore *.test.js --out-dir dist --copy-files",
"test": "xo && nyc ava",

@@ -18,2 +20,4 @@ "coverage": "nyc report --reporter=text-lcov | coveralls"

"ava": "^0.18.2",
"babel-cli": "^6.24.1",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"coveralls": "^2.11.16",

@@ -38,4 +42,4 @@ "micro": "^7.0.6",

"engines": {
"node": ">=7.6.0"
"node": ">=6.10.0"
}
}

@@ -64,3 +64,3 @@ :station: _**Micro Router -**_ A tiny and functional router for Zeit's [micro](https://github.com/zeit/micro)

- `patch(path = String, handler = Function)`
- `delete(path = String, handler = Function)`
- `del(path = String, handler = Function)`
- `head(path = String, handler = Function)`

@@ -67,0 +67,0 @@ - `options(path = String, handler = Function)`

@@ -6,3 +6,3 @@ const { parse } = require('url')

const { query, pathname } = parse(url, true)
const route = new UrlPattern(pattern)
const route = pattern instanceof UrlPattern ? pattern : new UrlPattern(pattern)
const params = route.match(pathname)

@@ -9,0 +9,0 @@

const test = require('ava')
const UrlPattern = require('url-pattern')

@@ -14,1 +15,11 @@ const { getParamsAndQuery } = require('./')

})
test('getParamsAndQuery() with UrlPattern', t => {
const route = new UrlPattern('/hello/:msg')
const url = '/hello/world?id=0'
const { params, query } = getParamsAndQuery(route, url)
t.deepEqual(params, { msg: 'world' })
t.deepEqual(query, { id: '0' })
})
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