in src/apache-unomi-tracker.js [831:859]
convertUrlParametersToObj: function (searchString) {
if (!searchString) {
return null;
}
return searchString
.replace(/^\?/, '') // Only trim off a single leading interrobang.
.split('&')
.reduce((result, next) => {
if (next === '') {
return result;
}
let pair = next.split('=');
let key = decodeURIComponent(pair[0]);
let value = typeof pair[1] !== 'undefined' && decodeURIComponent(pair[1]) || undefined;
if (Object.prototype.hasOwnProperty.call(result, key)) { // Check to see if this property has been met before.
if (Array.isArray(result[key])) { // Is it already an array?
result[key].push(value);
} else { // Make it an array.
result[key] = [result[key], value];
}
} else { // First time seen, just add it.
result[key] = value;
}
return result;
}, /** @type Record<string, Array<string | undefined> | string | undefined> */({})
);
},