Socket
Socket
Sign inDemoInstall

router

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

router - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

15

HISTORY.md

@@ -0,5 +1,18 @@

1.1.2 / 2015-07-06
==================
* Fix hiding platform issues with `decodeURIComponent`
- Only `URIError`s are a 400
* Fix using `*` before params in routes
* Fix using capture groups before params in routes
* deps: path-to-regexp@0.1.6
* perf: enable strict mode
* perf: remove argument reassignments in routing
* perf: skip attempting to decode zero length string
* perf: use plain for loops
1.1.1 / 2015-05-25
==================
* Fix issue where `next('route')` in `app.param` would incorrectly skip values
* Fix issue where `next('route')` in `router.param` would incorrectly skip values
* deps: array-flatten@1.1.0

@@ -6,0 +19,0 @@ * deps: debug@~2.2.0

8

index.js

@@ -8,2 +8,4 @@ /*!

'use strict'
/**

@@ -471,3 +473,5 @@ * Module dependencies.

callbacks.forEach(function (fn) {
for (var i = 0; i < callbacks.length; i++) {
var fn = callbacks[i]
if (typeof fn !== 'function') {

@@ -489,3 +493,3 @@ throw new TypeError('argument handler must be a function')

this.stack.push(layer)
}, this)
}

@@ -492,0 +496,0 @@ return this

@@ -8,2 +8,4 @@ /*!

'use strict'
/**

@@ -36,3 +38,3 @@ * Module dependencies.

debug('new %s', path)
options = options || {}
var opts = options || {}

@@ -43,5 +45,5 @@ this.handle = fn

this.path = undefined
this.regexp = pathRegexp(path, this.keys = [], options)
this.regexp = pathRegexp(path, this.keys = [], opts)
if (path === '/' && options.end === false) {
if (path === '/' && opts.end === false) {
this.regexp.fast_slash = true

@@ -136,15 +138,10 @@ }

// iterate matches
var keys = this.keys
var params = this.params
var prop
var n = 0
var key
var val
for (var i = 1, len = m.length; i < len; ++i) {
key = keys[i - 1]
prop = key
? key.name
: n++
val = decode_param(m[i])
for (var i = 1; i < m.length; i++) {
var key = keys[i - 1]
var prop = key.name
var val = decode_param(m[i])

@@ -164,7 +161,7 @@ if (val !== undefined || !(hasOwnProperty.call(params, prop))) {

* @return {string}
* @api private
* @private
*/
function decode_param(val){
if (typeof val !== 'string') {
if (typeof val !== 'string' || val.length === 0) {
return val

@@ -175,7 +172,10 @@ }

return decodeURIComponent(val)
} catch (e) {
var err = new TypeError("Failed to decode param '" + val + "'")
err.status = 400
} catch (err) {
if (err instanceof URIError) {
err.message = 'Failed to decode param \'' + val + '\''
err.status = 400
}
throw err
}
}

@@ -8,2 +8,4 @@ /*!

'use strict'
/**

@@ -57,9 +59,10 @@ * Module dependencies.

method = method.toLowerCase()
// normalize name
var name = method.toLowerCase()
if (method === 'head' && !this.methods['head']) {
method = 'get'
if (name === 'head' && !this.methods['head']) {
name = 'get'
}
return Boolean(this.methods[method])
return Boolean(this.methods[name])
}

@@ -177,3 +180,5 @@

callbacks.forEach(function (fn) {
for (var i = 0; i < callbacks.length; i++) {
var fn = callbacks[i]
if (typeof fn !== 'function') {

@@ -188,3 +193,3 @@ throw new TypeError('argument handler must be a function')

this.stack.push(layer)
}, this)
}

@@ -202,3 +207,5 @@ return this

callbacks.forEach(function (fn) {
for (var i = 0; i < callbacks.length; i++) {
var fn = callbacks[i]
if (typeof fn !== 'function') {

@@ -215,3 +222,3 @@ throw new TypeError('argument handler must be a function')

this.stack.push(layer)
}, this)
}

@@ -218,0 +225,0 @@ return this

{
"name": "router",
"description": "Simple middleware-style router",
"version": "1.1.1",
"version": "1.1.2",
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",

@@ -13,3 +13,3 @@ "license": "MIT",

"parseurl": "~1.3.0",
"path-to-regexp": "0.1.3",
"path-to-regexp": "0.1.6",
"setprototypeof": "1.0.0",

@@ -20,4 +20,4 @@ "utils-merge": "1.0.0"

"after": "0.8.1",
"finalhandler": "0.3.6",
"istanbul": "0.3.9",
"finalhandler": "0.4.0",
"istanbul": "0.3.17",
"mocha": "2.2.5",

@@ -24,0 +24,0 @@ "supertest": "1.0.1"

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