index.js
function encodeURIParams(params, prefix) {
    let parts = [];
    for (const name in params) {
        if (Object.prototype.hasOwnProperty.call(params, name)) {
            const paramName = prefix ? (`${prefix}[${encodeURIComponent(name)}]`) : encodeURIComponent(name);
            if (typeof params[name] === 'object') {
                parts = Array.prototype.concat.apply(parts,
                    encodeURIParams(params[name], paramName));
            } else {
                parts.push(`${paramName}=${encodeURIComponent(params[name])}`);
            }
        }
    }
    return parts;
}
function encodeURIParams(params, prefix) {
    let parts = [];
    for (const name in params) {
        if (Object.prototype.hasOwnProperty.call(params, name)) {
            const paramName = prefix ? (`${prefix}[${encodeURIComponent(name)}]`) : encodeURIComponent(name);
            if (typeof params[name] === 'object') {
                parts = Array.prototype.concat.apply(parts,
                    encodeURIParams(params[name], paramName));
            } else {
                parts.push(`${paramName}=${encodeURIComponent(params[name])}`);
            }
        }
    }
    return parts;
}
function encodeURIParams ( params , prefix ) { let parts = [ ] ; for ( const name in params ) { if ( Object . prototype . hasOwnProperty . call ( params , name ) ) { const paramName = prefix ? ( ` ${ prefix } ${ encodeURIComponent ( name ) } ` ) : encodeURIComponent ( name ) ; if ( typeof params [ name ] === 'object' ) { parts = Array . prototype . concat . apply ( parts , encodeURIParams ( params [ name ] , paramName ) ) ; } else { parts . push ( ` ${ paramName } ${ encodeURIComponent ( params [ name ] ) } ` ) ; } } } return parts ; }
Encode an object as URI parameters

@param {Object} params Parameter object
@param {String} prefix Parameter prefix
@return {Array} Encoded URI parameters
Encode an object as URI parameters