const QueryString = (() => {
    const queryStringToObject = (query_string) => query_string
        .slice(1)
        .split('&')
        .map(pair => pair.split('='))
        .reduce((obj, [ key, val ]) => {
            obj[key] = window.decodeURI(val);
            return obj;
        }, {});

    const removeParamFromQueryString = (query_string, removal_key) => {
        const query_obj = queryStringToObject(query_string);
        const new_query_str = Object.keys(query_obj)
            .filter(key => key !== removal_key)
            .map(key => `${key}=${query_obj[key]}`)
            .join('&');
        return new_query_str !== '' ? `?${new_query_str}` : '';
    };

    const setQueryStringWithoutReload = (new_query_str) => {
        const { pathname, hash } = window.location;
        window.history.replaceState('', '', `${pathname}${new_query_str}${hash}`);
    };

    return {
        queryStringToObject,
        removeParamFromQueryString,
        setQueryStringWithoutReload,
    };
})();

module.exports = QueryString;
@@ -76,21 +76,86 @@
  =%3E 
-query_string%0A
+%7B%0A        if (query_string === '') return %7B%7D;%0A        return query_string%0A    
     
@@ -176,16 +176,20 @@
         
+ 
+   
 .split('
@@ -196,24 +196,28 @@
 &')%0A        
+   
+ 
 .map(pair =%3E
@@ -234,16 +234,20 @@
 t('='))%0A
+    
         
@@ -291,16 +291,20 @@
         
+ 
+   
 obj%5Bkey%5D
@@ -337,24 +337,28 @@
             
+   
+ 
 return obj;%0A
@@ -369,15 +369,26 @@
     
+    
 %7D, %7B%7D);
+%0A    %7D;
 %0A%0A  

fix string to object conversion for empty string