Commit e781e1a3 authored by Jose Vargas's avatar Jose Vargas

Break out function result

parent ad5c2fee
......@@ -270,9 +270,9 @@ export function getWebSocketUrl(path) {
export function queryToObject(query) {
const removeQuestionMarkFromQuery = String(query).startsWith('?') ? query.slice(1) : query;
return removeQuestionMarkFromQuery.split('&').reduce((accumulator, curr) => {
const p = curr.split('=');
if (p[1] !== undefined) {
accumulator[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
const [key, value] = curr.split('=');
if (value !== undefined) {
accumulator[decodeURIComponent(key)] = decodeURIComponent(value);
}
return accumulator;
}, {});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment