src/obj.util.js
function toURI(obj, dontEncode) {
    const arr = [];
    let paramVal;

    if (isObject(obj) && !isArray(obj)) {
        Object.keys(obj).forEach((val) => {
            if (isArray(obj[val])) {
                paramVal = `[${obj[val].join(',')}]`;
            } else {
                paramVal = obj[val];
            }

            if (dontEncode) {
                arr.push(`${val}=${paramVal}`);
            } else {
                arr.push(
                    `${encodeURIComponent(val)}=${encodeURIComponent(paramVal)}`
                );
            }
        });
    }

    return arr.join('&');
}
function toURI(obj, dontEncode) {
    const arr = [];
    let paramVal;

    if (isObject(obj) && !isArray(obj)) {
        Object.keys(obj).forEach((val) => {
            if (isArray(obj[val])) {
                paramVal = `[${obj[val].join(',')}]`;
            } else {
                paramVal = obj[val];
            }

            if (dontEncode) {
                arr.push(`${val}=${paramVal}`);
            } else {
                arr.push(
                    `${encodeURIComponent(val)}=${encodeURIComponent(paramVal)}`
                );
            }
        });
    }

    return arr.join('&');
}
Transforms the properties in an object to an encoded URI query string.
<b>Note</b>: works best if the object is in the format of
{ propertyName: propertyValue, propertyName2: propertyValue2 . . }
@method utilitarian.obj.util#toURI
@param {object} obj A JSON object to serialize into a query string
@param {boolean} [dontEncode] An optional boolean value to control whether
or not to URI encode the resulting query string (defaults to `false`)
@returns {string} A query string representation of the original object