import numeral from '@elastic/numeral' ; export type DataType = 'byte' | 'float' | 'integer' | 'time' ; export function formatNumber ( num , type ? ) { let format ; let postfix = '' ; switch ( type ) { case 'byte' : format = '0.00 b' ; break ; case 'time' : format = '0.00' ; postfix = ' ms' ; break ; case 'integer' : format = '0' ; break ; case 'float' : default : format = '0.00' ; } return numeral ( num ) . format ( format ) + postfix ; }