export function formatPercentValue ( rate , fractionDigits = 1 ) { const fixed = rate . toFixed ( fractionDigits ) ; let displayValue = fixed ; if ( rate !== 0 && Number ( fixed ) === 0 ) { displayValue = `< ${ 1 / Math . pow ( 10 , fractionDigits ) }` ; } return displayValue ; } export function numberOfLeadingDecimalZeros ( value ) { return - Math . floor ( Math . log10 ( value ) / Math . log10 ( 10 ) + 1 ) ; } export function formatFrequencyValue ( value , fractionDigits = 1 ) { return value === null ? '-' : formatPercentValue ( value * 100 , fractionDigits ) ; } export function formatNumberValueInSignificantDigits ( value , significantDigits ? ) { if ( value === 0 ) { return 0 ; } else if ( value === null ) { return null ; } else if ( significantDigits ) { return Number ( value . toLocaleString ( undefined , { maximumSignificantDigits : significantDigits , } ) ) ; } else { return value ; } }