formatPercent.tsx 373 B

12345678910
  1. import {formatNumberWithDynamicDecimalPoints} from 'sentry/utils/number/formatNumberWithDynamicDecimalPoints';
  2. interface Options {
  3. addSymbol?: boolean;
  4. }
  5. export function formatPercent(value: number, {addSymbol}: Options = {}) {
  6. const formatedNumber = formatNumberWithDynamicDecimalPoints(value * 100, 2);
  7. return addSymbol ? `${formatedNumber}%` : formatedNumber;
  8. }