Skip to content
Myr

arity < 3 considered return-style param

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 0f5dc9b · Browse files · 2 files+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+2 added−2 removed

  • tests:+1 added−1 removed
  • other:+1 added−1 removed

2 files+2 added−2 removed

modified:lib/router/index.js+1 added-1 removed
115 unmodified lines
116 next(err);117 // Param has callback118 } else if (fn) {119 // Return style120 if (1 == fn.length) {120 if (fn.length < 3) {121 ret = req.params[key] = fn(val);122 if (invalidParam(ret)) {123 pass(req._route_index + 1);124 return;
219 unmodified lines
modified:test/router.test.js+1 added-1 removed
153 unmodified lines
154 155 'test .param() ret val': function(){156 var app = express.createServer();157158 app.param('uid', function(id){ return parseInt(id) });158 app.param('uid', parseInt);159160 app.get('/user/:uid', function(req, res, next){161 var id = req.params.uid;162 res.send('loaded user ' + id + ' as typeof ' + typeof id);
156 unmodified lines