Insertar parámetros en URL con Javascript

function insertParam(uri, key, value) {
    if (key.toString().indexOf(",") > -1) {
        key = key.split(",");
    }
    if (value.toString().indexOf(",") > -1) {
        value = value.split(",");
    }

    if ( _.isArray(value) ) {
        _.each(value, function (val, index) {http://localhost/produban/areaHome.php#
            uri = insertParamCore(uri, key[index], val);
        });
    } else {
        uri = insertParamCore(uri, key, value);
    }

    return uri;
}

function insertParamCore(uri, key, value) {
    var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
    var separator = uri.indexOf('?') !== -1 ? "&" : "?";
    if (uri.match(re)) {
        return uri.replace(re, '$1' + key + "=" + value + '$2');
    }
    else {
        return uri + separator + key + "=" + value;
    }
}