import { DATA_FORMATTERS } from '../../../../common/enums' ; import { isDuration } from './durations' ; export const getFormatterType = ( formatter ) => { if ( [ DATA_FORMATTERS . NUMBER , DATA_FORMATTERS . BYTES , DATA_FORMATTERS . PERCENT , DATA_FORMATTERS . DEFAULT , ] . includes ( formatter as DATA_FORMATTERS ) ) { return formatter as DATA_FORMATTERS ; } return formatter && isDuration ( formatter ) ? DATA_FORMATTERS . DURATION : DATA_FORMATTERS . CUSTOM ; } ;