lib/utensils.js
function parseIfJson(val) {
    if (_.isString(val)) {
        val = val.trim();
        if (val.substring(0, 1) === '{' && val.substring(val.length - 1) === '}') {
            try {
                val = JSON.parse(val);
            }
            catch (ex) {
                /* eslint no-console:0 */
                console.log(ex);
            }
        }
    }
    return val;
}
function parseIfJson(val) {
    if (_.isString(val)) {
        val = val.trim();
        if (val.substring(0, 1) === '{' && val.substring(val.length - 1) === '}') {
            try {
                val = JSON.parse(val);
            }
            catch (ex) {
                /* eslint no-console:0 */
                console.log(ex);
            }
        }
    }
    return val;
}
function parseIfJson ( val ) { if ( _ . isString ( val ) ) { val = val . trim ( ) ; if ( val . substring ( 0 , 1 ) === '{' && val . substring ( val . length - 1 ) === '}' ) { try { val = JSON . parse ( val ) ; } catch ( ex ) { /* eslint no-console:0 */ console . log ( ex ) ; } } } return val ; }
If a value is a string of json, parse it out into an object
@param val
@returns {*}
If a value is a string of json parse it out into an object