lib/configDeclarationToYargs.js
function validateParameterValue (parameter, type, format, value) {
  if (type === 'integer') {
    const parsedValue = Number.parseInt(value)
    if (_.isNaN(parsedValue)) {
      throw new Error(`Invalid "${parameter}" value: failed to parse "${value}" as integer`)
    }
    return parsedValue
  } else if (type === 'number') {
    const parsedValue = Number.parseFloat(value)
    if (_.isNaN(parsedValue)) {
      throw new Error(`Invalid "${parameter}" value: failed to parse "${value}" as number`)
    }
    return Number.isInteger(parsedValue) ? Number.parseInt(value) : parsedValue
  } else if (type === 'string' && format) {
    if (format === 'date-time' && !moment(value, moment.ISO_8601).isValid()) {
      throw new Error(`Invalid "${parameter}" value: failed to parse "${value}" as date-time string`)
    } else if (format === 'date' && !moment(value, 'YYYY-MM-DD').isValid()) {
      throw new Error(`Invalid "${parameter}" value: failed to parse "${value}" as date string`)
    }
    return value
  }

  return value
}
function validateParameterValue (parameter, type, format, value) {
  if (type === 'integer') {
    const parsedValue = Number.parseInt(value)
    if (_.isNaN(parsedValue)) {
      throw new Error(`Invalid "${parameter}" value: failed to parse "${value}" as integer`)
    }
    return parsedValue
  } else if (type === 'number') {
    const parsedValue = Number.parseFloat(value)
    if (_.isNaN(parsedValue)) {
      throw new Error(`Invalid "${parameter}" value: failed to parse "${value}" as number`)
    }
    return Number.isInteger(parsedValue) ? Number.parseInt(value) : parsedValue
  } else if (type === 'string' && format) {
    if (format === 'date-time' && !moment(value, moment.ISO_8601).isValid()) {
      throw new Error(`Invalid "${parameter}" value: failed to parse "${value}" as date-time string`)
    } else if (format === 'date' && !moment(value, 'YYYY-MM-DD').isValid()) {
      throw new Error(`Invalid "${parameter}" value: failed to parse "${value}" as date string`)
    }
    return value
  }

  return value
}
function validateParameterValue ( parameter , type , format , value ) { if ( type === 'integer' ) { const parsedValue = Number . parseInt ( value ) if ( _ . isNaN ( parsedValue ) ) { throw new Error ( ` ${ parameter } ${ value } ` ) } return parsedValue } else if ( type === 'number' ) { const parsedValue = Number . parseFloat ( value ) if ( _ . isNaN ( parsedValue ) ) { throw new Error ( ` ${ parameter } ${ value } ` ) } return Number . isInteger ( parsedValue ) ? Number . parseInt ( value ) : parsedValue } else if ( type === 'string' && format ) { if ( format === 'date-time' && ! moment ( value , moment . ISO_8601 ) . isValid ( ) ) { throw new Error ( ` ${ parameter } ${ value } ` ) } else if ( format === 'date' && ! moment ( value , 'YYYY-MM-DD' ) . isValid ( ) ) { throw new Error ( ` ${ parameter } ${ value } ` ) } return value } return value }
Validates parameter value
Validates parameter value