export function toNumber ( value ) { const num = parseFloat ( value ) ; return isNaN ( num ) ? 0 : num ; } export function toPrecision ( value , precision ? ) { const nextValue = toNumber ( value ) ; return precision ? toNumber ( nextValue . toFixed ( precision ) ) : nextValue ; } export function toPercent ( value ) { return `${ value * 100 }%` ; }