UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

17 lines 733 B
import { CURRENCY, CURRENCY_DISPLAY, CURRENCY_FALLBACK_DISPLAY } from "../../../shared/defaults.js"; const validCurrencyDisplayValues = new Set(['code', 'name', 'symbol', 'narrowSymbol']); function isCurrencyDisplayValue(value) { return validCurrencyDisplayValues.has(value); } export function getFallbackCurrencyDisplay(locale = null, currencyDisplay = null) { if (!currencyDisplay && (!locale || /(no|nb|nn)$/i.test(locale))) { currencyDisplay = CURRENCY_DISPLAY; } const value = String(currencyDisplay || ''); if (isCurrencyDisplayValue(value)) { return value; } return CURRENCY_FALLBACK_DISPLAY; } export { CURRENCY, CURRENCY_DISPLAY, CURRENCY_FALLBACK_DISPLAY }; //# sourceMappingURL=currencyDisplay.js.map