src/cli/commands/parseOptions.js
function convert(value, mapping) {
    const val = mapping.converter(value);
    const validationResult = isValid(val, mapping.validator);
    if (validationResult === true) {
        return val;
    }

    // Make sure that we got something from the conversion.
    const message = val !== undefined && val !== null && val.toString().length > 0 ?
        `Received ${underline(JSON.stringify(value))} and it was converted to ` +
            `${underline(JSON.stringify(val))}. ` :
        '';

    log.warn(
        `There was a problem when trying to automatically convert ${bold(mapping.name)}. This ` +
            `value will be ignored.\n\n` +
            message + validationResult,
        'Conversion Problem'
    );

    return undefined;
}
function convert(value, mapping) {
    const val = mapping.converter(value);
    const validationResult = isValid(val, mapping.validator);
    if (validationResult === true) {
        return val;
    }

    // Make sure that we got something from the conversion.
    const message = val !== undefined && val !== null && val.toString().length > 0 ?
        `Received ${underline(JSON.stringify(value))} and it was converted to ` +
            `${underline(JSON.stringify(val))}. ` :
        '';

    log.warn(
        `There was a problem when trying to automatically convert ${bold(mapping.name)}. This ` +
            `value will be ignored.\n\n` +
            message + validationResult,
        'Conversion Problem'
    );

    return undefined;
}
function convert ( value , mapping ) { const val = mapping . converter ( value ) ; const validationResult = isValid ( val , mapping . validator ) ; if ( validationResult === true ) { return val ; } // Make sure that we got something from the conversion. const message = val !== undefined && val !== null && val . toString ( ) . length > 0 ? ` ${ underline ( JSON . stringify ( value ) ) } ` + ` ${ underline ( JSON . stringify ( val ) ) } ` : '' ; log . warn ( ` ${ bold ( mapping . name ) } ` + ` \n \n ` + message + validationResult , 'Conversion Problem' ) ; return undefined ; }
/* eslint-enable
/ * eslint - enable