import { isValidOpenSearchInterval } from './is_valid_opensearch_interval' ; import { leastCommonInterval } from './least_common_interval' ; function parseWithBase ( value , baseInterval ) { try { const interval = leastCommonInterval ( baseInterval , value ) ; return interval === value . replace ( /\s/g , '' ) ; } catch ( e ) { return false ; } } export function isValidInterval ( value , baseInterval ? ) { if ( baseInterval ) { return parseWithBase ( value , baseInterval ) ; } else { return isValidOpenSearchInterval ( value ) ; } }