in public/js/util/urlParameters.js [34:60]
export function paramStringToObject(string) {
const stringNoQuestion = string[0] === "?" ? string.slice(1, string.length) : string;
const params = stringNoQuestion.split("&");
const paramsObject = params.reduce((paramsObject, param) => {
const splitParam = param.split("=");
if (splitParam.length !== 2) {
return paramsObject; //Not key=value fail fast
}
const rawKey = decodeURIComponent(splitParam[0]);
const rawValue = decodeURIComponent(splitParam[1]);
const isArray = rawKey.indexOf('[]') !== -1;
const key = isArray ? rawKey.replace("[]", '') : rawKey; // Strip off the [] if array
const value = isArray ? _get(paramsObject, key, []).concat([rawValue]) : rawValue; // add to any existing values if array
return Object.assign({}, _set(paramsObject, key, value));
}, {});
return paramsObject;
}