MCPcopy Create free account
hub / github.com/Exrick/xpay / parseString

Function parseString

xpay-code/src/main/resources/static/swagger/swagger-ui.js:20316–20334  ·  view source on GitHub ↗

* Parse the given x-www-form-urlencoded `str`. * * @param {String} str * @return {Object} * @api private

(str)

Source from the content-addressed store, hash-verified

20314 */
20315
20316function 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.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected