Skip to content
Myr

Added param()

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

authored by visionmedia · committed by visionmedia · parent 9667cbc · Browse files · 3 files+26 added−1 removed
This commit

State

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

Diff stats

3 files+26 added−1 removed

  • tests:+12 added−0 removed
  • other:+14 added−1 removed

3 files+26 added−1 removed

modified:lib/express/core.js+14 added-1 removed
18 unmodified lines
19// --- Router2021Router = Class({22 captures: [],23 params: {},24 route: function(request){25 this.request = request26 return this.matchingRoute().run()27 },
13 unmodified lines
41 */4243 match: function(route) {44 if (this.request.method.toLowerCase() == route.method)44 return (this.captures = this.request.uri.path.match(route.path))45 if (this.captures = this.request.uri.path.match(route.path)) {46 this.mapParams()47 return true48 }49 },50 51 mapParams: function() {52 for (var i = 0, len = keys.length; i < len; ++i)53 this.params[keys[i]] = this.captures[i+1]54 }55})5657// --- Server
43 unmodified lines
101function normalizePath(path) {102 return path.replace(/[\s\/]*$/g, '')103}104105param = function(key) {106 return Express.server.router.params[key]107}108109/**110 * Escape special characters in _html_.111 *112 * @param {string} html
106 unmodified lines
added:spec/spec.core.helpers.js+11 added
modified:spec/spec.node.js+1 added