Skip to content
Myr

Started parseNestedParams()

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

authored by visionmedia · committed by visionmedia · parent 7be9f44 · Browse files · 2 files+21 added−6 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+21 added−6 removed

  • tests:+9 added−6 removed
  • other:+12 added−0 removed

2 files+21 added−6 removed

modified:lib/express.core.js+12 added
143 unmodified lines
144 return this.request.uri.params[key] || defaultValue145 },146 147 parseNestedParams : function(params) {148 for (var key in params)149 if (params.hasOwnProperty(key))150 if (captures = key.match(/\[[^\]]+\]/g))151 for (var i = 0, last = params, len = captures.length; i < len; ++i)152 if (i == len - 1) {153 last = last[captures[i].replace(/\[|\]/g, '')] = params[key]154 delete params[key]155 }156 else {157 last = last[captures[i].replace(/\[|\]/g, '')] = {}158 }159 160 return params161 },162 163 /**
188 unmodified lines
modified:spec/spec.core.js+9 added-6 removed