UNPKG

@adyen/adyen-platform-experience-web

Version:

![Platform Experience header](https://github.com/Adyen/adyen-platform-experience-web/assets/7926613/18094965-9e01-450e-8dc9-ea84e6b22c2b)

27 lines (26 loc) 844 B
import u from "../constants/currency-codes.js"; import a from "../constants/currency-decimals.js"; const l = (t) => a[t] || 100, y = (t) => !!u[t], A = (t) => y(t) ? u[t] : null, C = (t, e) => { const r = l(e); return parseInt(String(t), 10) / r; }, D = (t, e, r, o = !1, n = {}) => { const c = t.toString(), s = C(c, r), i = e.replace("_", "-"), m = { style: "currency", currency: r, currencyDisplay: "symbol", ...n }; try { return o ? f(i, m, s) : s.toLocaleString(i, m); } catch { return c; } }, f = (t, e, r) => Intl.NumberFormat(t, e).formatToParts(r).filter((o) => o.type !== "currency").reduce((o, n) => o + n.value, "").trim(); export { f as formatAmountWithoutCurrency, A as getCurrencyCode, C as getDecimalAmount, l as getDivider, D as getLocalisedAmount, y as isValidCurrencyCode };