function toParam(obj, dontEncode) {
    const arr = [];
    let vals;

    if (isObject(obj) && !isArray(obj)) {
        Object.keys(obj).forEach((val) => {
            if (isArray(obj[val])) {
                vals = `[${
                    obj[val].map(v => (isNaN(v) ? `"${v}"` : v)).join(',')
                }]`;
            } else {
                vals = isNaN(obj[val]) ? `"${obj[val]}"` : obj[val];
            }
            arr.push(`${val}:${vals}`);
        });

        if (dontEncode) {
            return `{${arr.join(',')}}`;
        }

        return encodeURIComponent(`{${arr.join(',')}}`);
    }

    return '';
}
function toParam(obj, dontEncode) {
    const arr = [];
    let vals;

    if (isObject(obj) && !isArray(obj)) {
        Object.keys(obj).forEach((val) => {
            if (isArray(obj[val])) {
                vals = `[${
                    obj[val].map(v => (isNaN(v) ? `"${v}"` : v)).join(',')
                }]`;
            } else {
                vals = isNaN(obj[val]) ? `"${obj[val]}"` : obj[val];
            }
            arr.push(`${val}:${vals}`);
        });

        if (dontEncode) {
            return `{${arr.join(',')}}`;
        }

        return encodeURIComponent(`{${arr.join(',')}}`);
    }

    return '';
}
function toParam ( obj , dontEncode ) { const arr = [ ] ; let vals ; if ( isObject ( obj ) && ! isArray ( obj ) ) { Object . keys ( obj ) . forEach ( ( val ) => { if ( isArray ( obj [ val ] ) ) { vals = ` ${ obj [ val ] . map ( v => ( isNaN ( v ) ? ` ${ v } ` : v ) ) . join ( ',' ) } ` ; } else { vals = isNaN ( obj [ val ] ) ? ` ${ obj [ val ] } ` : obj [ val ] ; } arr . push ( ` ${ val } ${ vals } ` ) ; } ) ; if ( dontEncode ) { return ` ${ arr . join ( ',' ) } ` ; } return encodeURIComponent ( ` ${ arr . join ( ',' ) } ` ) ; } return '' ; }
Serializes an object's properties into JSON string then URI encoded
@method utilitarian.obj.util#toParam
@param {object} obj A JSON object to serialize into a query string parameter
@param {boolean} [dontEncode] An optional boolean value to control whether or not to URI encode the resulting query parameter (defaults to `false`)
@returns {string} A query string parameter representation of the original object
Serializes an object s properties into JSON string then URI encoded