(code: string, format: 'wide' | 'narrow', locale = 'en')
| 795 | * Note: `US$` is a currency symbol for the `en-ca` locale but not the `en-us` locale. |
| 796 | */ |
| 797 | export function getCurrencySymbol(code: string, format: 'wide' | 'narrow', locale = 'en'): string { |
| 798 | const currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || []; |
| 799 | const symbolNarrow = currency[ɵCurrencyIndex.SymbolNarrow]; |
| 800 | |
| 801 | if (format === 'narrow' && typeof symbolNarrow === 'string') { |
| 802 | return symbolNarrow; |
| 803 | } |
| 804 | |
| 805 | return currency[ɵCurrencyIndex.Symbol] || code; |
| 806 | } |
| 807 | |
| 808 | // Most currencies have cents, that's why the default is 2 |
| 809 | const DEFAULT_NB_OF_CURRENCY_DIGITS = 2; |
no test coverage detected