MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / parseKeyValue

Function parseKeyValue

lib/test/angular/1.5.0/angular.js:1357–1382  ·  view source on GitHub ↗

* Parses an escaped url query string into key-value pairs. * @returns {Object. }

(/**string*/keyValue)

Source from the content-addressed store, hash-verified

1355 * @returns {Object.<string,boolean|Array>}
1356 */
1357function parseKeyValue(/**string*/keyValue) {
1358 var obj = {};
1359 forEach((keyValue || "").split('&'), function(keyValue) {
1360 var splitPoint, key, val;
1361 if (keyValue) {
1362 key = keyValue = keyValue.replace(/\+/g,'%20');
1363 splitPoint = keyValue.indexOf('=');
1364 if (splitPoint !== -1) {
1365 key = keyValue.substring(0, splitPoint);
1366 val = keyValue.substring(splitPoint + 1);
1367 }
1368 key = tryDecodeURIComponent(key);
1369 if (isDefined(key)) {
1370 val = isDefined(val) ? tryDecodeURIComponent(val) : true;
1371 if (!hasOwnProperty.call(obj, key)) {
1372 obj[key] = val;
1373 } else if (isArray(obj[key])) {
1374 obj[key].push(val);
1375 } else {
1376 obj[key] = [obj[key],val];
1377 }
1378 }
1379 }
1380 });
1381 return obj;
1382}
1383
1384function toKeyValue(obj) {
1385 var parts = [];

Callers 2

parseAppUrlFunction · 0.70
angular.jsFile · 0.70

Calls 4

forEachFunction · 0.70
tryDecodeURIComponentFunction · 0.70
isDefinedFunction · 0.70
isArrayFunction · 0.50

Tested by

no test coverage detected