import numeral from '@elastic/numeral' ; import { Stat } from '../typings' ; export function formatStatValue ( stat ) { const { value , type } = stat ; switch ( type ) { case 'bytesPerSecond' : return `${ numeral ( value ) . format ( '0.0b' ) }/s` ; case 'number' : return numeral ( value ) . format ( '0a' ) ; case 'percent' : return numeral ( value ) . format ( '0.0%' ) ; } }