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], d = (t) => y(t) ? u[t] : null, C = (t, o) => { const r = l(o); return parseInt(String(t), 10) / r; }, A = (t, o, r, e = !1, n = {}) => { const c = t.toString(), s = C(c, r), i = o.replace("_", "-"), m = { style: "currency", currency: r, currencyDisplay: "symbol", ...n }; try { return e ? f(i, m, s) : s.toLocaleString(i, m); } catch { return c; } }, f = (t, o, r) => Intl.NumberFormat(t, o).formatToParts(r).filter((e) => e.type !== "currency").reduce((e, n) => e + n.value, "").trim(); export { f as formatAmountWithoutCurrency, d as getCurrencyCode, C as getDecimalAmount, l as getDivider, A as getLocalisedAmount, y as isValidCurrencyCode };