(delta: Nullish<number>, locale: SupportedLocale = DEFAULT_LOCALE)
| 544 | |
| 545 | // Used to format floats representing percent change with fixed decimal places |
| 546 | function formatDelta(delta: Nullish<number>, locale: SupportedLocale = DEFAULT_LOCALE) { |
| 547 | if (delta === null || delta === undefined || delta === Infinity || isNaN(delta)) { |
| 548 | return '-' |
| 549 | } |
| 550 | |
| 551 | return `${Number(Math.abs(delta).toFixed(2)).toLocaleString(locale, { |
| 552 | minimumFractionDigits: 2, |
| 553 | maximumFractionDigits: 2, |
| 554 | useGrouping: false, |
| 555 | })}%` |
| 556 | } |
| 557 | |
| 558 | interface FormatPriceOptions { |
| 559 | price: Nullish<Price<Currency, Currency>> |
no outgoing calls
no test coverage detected
searching dependent graphs…