(code: string, format: 'wide' | 'narrow', locale = 'en')
| 768 | * Note: `US$` is a currency symbol for the `en-ca` locale but not the `en-us` locale. |
| 769 | */ |
| 770 | export function getCurrencySymbol(code: string, format: 'wide' | 'narrow', locale = 'en'): string { |
| 771 | const currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || []; |
| 772 | const symbolNarrow = currency[ɵCurrencyIndex.SymbolNarrow]; |
| 773 | |
| 774 | if (format === 'narrow' && typeof symbolNarrow === 'string') { |
| 775 | return symbolNarrow; |
| 776 | } |
| 777 | |
| 778 | return currency[ɵCurrencyIndex.Symbol] || code; |
| 779 | } |
| 780 | |
| 781 | // Most currencies have cents, that's why the default is 2 |
| 782 | const DEFAULT_NB_OF_CURRENCY_DIGITS = 2; |
no test coverage detected
searching dependent graphs…