* Parse the given x-www-form-urlencoded `str`. * * @param {String} str * @return {Object} * @api private
(str)
| 20314 | */ |
| 20315 | |
| 20316 | function parseString(str) { |
| 20317 | var obj = {}; |
| 20318 | var pairs = str.split('&'); |
| 20319 | var pair; |
| 20320 | var pos; |
| 20321 | |
| 20322 | for (var i = 0, len = pairs.length; i < len; ++i) { |
| 20323 | pair = pairs[i]; |
| 20324 | pos = pair.indexOf('='); |
| 20325 | if (pos == -1) { |
| 20326 | obj[decodeURIComponent(pair)] = ''; |
| 20327 | } else { |
| 20328 | obj[decodeURIComponent(pair.slice(0, pos))] = |
| 20329 | decodeURIComponent(pair.slice(pos + 1)); |
| 20330 | } |
| 20331 | } |
| 20332 | |
| 20333 | return obj; |
| 20334 | } |
| 20335 | |
| 20336 | /** |
| 20337 | * Expose parser. |
nothing calls this directly
no outgoing calls
no test coverage detected