MCPcopy Index your code
hub / github.com/angular/angular / getCurrencySymbol

Function getCurrencySymbol

packages/common/src/i18n/locale_data_api.ts:770–779  ·  view source on GitHub ↗
(code: string, format: 'wide' | 'narrow', locale = 'en')

Source from the content-addressed store, hash-verified

768 * Note: `US$` is a currency symbol for the `en-ca` locale but not the `en-us` locale.
769 */
770export 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
782const DEFAULT_NB_OF_CURRENCY_DIGITS = 2;

Callers 2

transformMethod · 0.90

Calls 1

getLocaleCurrenciesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…