import { isFinite } from 'lodash' ; import { i18n } from '@kbn/i18n' ; import { amountAndUnitToObject } from '../amount_and_unit' ; function getRangeType ( min ? , max ? ) { if ( isFinite ( min ) && isFinite ( max ) ) { return 'between' ; } else if ( isFinite ( min ) ) { return 'gt' ; } else if ( isFinite ( max ) ) { return 'lt' ; } } export function getRangeTypeMessage ( min ? , max ? ) { return i18n . translate ( 'xpack.apm.agentConfig.range.errorText' , { defaultMessage : `{rangeType, select,
        between {Must be between {min} and {max}}
        gt {Must be greater than {min}}
        lt {Must be less than {max}}
        other {Must be an integer}
      }` , values : { min , max , rangeType : getRangeType ( typeof min === 'string' ? amountAndUnitToObject ( min ) . amount : min , typeof max === 'string' ? amountAndUnitToObject ( max ) . amount : max ) , } , } ) ; }