MCPcopy
hub / github.com/Uniswap/interface / formatPercent

Function formatPercent

src/utils/formatNumbers.ts:536–543  ·  view source on GitHub ↗
(percent: Percent | undefined, locale: SupportedLocale = DEFAULT_LOCALE)

Source from the content-addressed store, hash-verified

534}
535
536function formatPercent(percent: Percent | undefined, locale: SupportedLocale = DEFAULT_LOCALE) {
537 if (!percent) return '-'
538
539 return `${Number(percent.toFixed(3)).toLocaleString(locale, {
540 maximumFractionDigits: 3,
541 useGrouping: false,
542 })}%`
543}
544
545// Used to format floats representing percent change with fixed decimal places
546function formatDelta(delta: Nullish<number>, locale: SupportedLocale = DEFAULT_LOCALE) {

Callers 13

PriceImpactModalFunction · 0.85
PriceImpactRowFunction · 0.85
ColoredPercentRowFunction · 0.85
useLineItemFunction · 0.85
PriceImpactWarningFunction · 0.85
TokenDescriptionFunction · 0.85
useFormatPercentInputFunction · 0.85
MaxSlippageSettingsFunction · 0.85
ButtonContentFunction · 0.85
FiatValueFunction · 0.85
useFormatterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…