lib/parser.js
function parseJSON(cmd) {
    try {
        var json = JSON.parse(cmd.rest);
    } catch (e) {
        return false;
    }

    // Ensure it's an array.
    if (!Array.isArray(json)) {
        return false;
    }

    // Ensure every entry in the array is a string.
    if (!json.every(function (entry) {
            return typeof(entry) === 'string';
        })) {
        return false;
    }

    cmd.args = json;
    return true;
}
function parseJSON(cmd) {
    try {
        var json = JSON.parse(cmd.rest);
    } catch (e) {
        return false;
    }

    // Ensure it's an array.
    if (!Array.isArray(json)) {
        return false;
    }

    // Ensure every entry in the array is a string.
    if (!json.every(function (entry) {
            return typeof(entry) === 'string';
        })) {
        return false;
    }

    cmd.args = json;
    return true;
}
function parseJSON ( cmd ) { try { var json = JSON . parse ( cmd . rest ) ; } catch ( e ) { return false ; } // Ensure it's an array. if ( ! Array . isArray ( json ) ) { return false ; } // Ensure every entry in the array is a string. if ( ! json . every ( function ( entry ) { return typeof ( entry ) === 'string' ; } ) ) { return false ; } cmd . args = json ; return true ; }
Converts to JSON array, returns true on success, false otherwise.
Converts to JSON array returns true on success false otherwise .