Skip to content
Myr

misc refactoring

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 8b2268c · Browse files · 2 files+5 added−10 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+5 added−10 removed

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

2 files+5 added−10 removed

modified:lib/router/index.js+4 added-9 removed
174 unmodified lines
175 if (method) {176 method = method.toUpperCase();177 if (routes[method]) {178 routes[method].forEach(function(route, i){179 if (path == route.orig) {180 var fn = route.fn;181 fn.regexp = route.path;182 fn.keys = route.keys;183 fn.path = route.orig;184 fn.method = route.method;185 fn.index = i;186 ret.push(fn);179 if (path == route.path) {180 route.index = i;181 ret.push(route);182 }183 });184 }185 // global lookup
60 unmodified lines
246function optionsFor(path, routes) {247 return _methods.filter(function(method){248 var arr = routes[method.toUpperCase()];249 for (var i = 0, len = arr.length; i < len; ++i) {255 if (arr[i].path.test(path)) return true;250 if (arr[i].regexp.test(path)) return true;251 }252 }).map(function(method){253 return method.toUpperCase();254 });
46 unmodified lines
modified:test/express.test.js+1 added-1 removed
590 unmodified lines
591 app.put('/user/:id').should.have.length(1);592 app.get('/user/:id/edit').should.have.length(1);593 app.get('/').should.have.be.empty;594 app.all('/user/:id').should.have.length(2);595 595596 app.lookup.get('/user').should.have.length(1);597 app.lookup.get('/user/:id').should.have.length(1);598 app.lookup.get('/user/:id/:op?').should.have.length(1);599 app.lookup.put('/user/:id').should.have.length(1);
22 unmodified lines