@plasma-platform/plasma-currency-formatter

Currency formatting depending on locale

Usage no npm install needed!

<script type="module">
  import plasmaPlatformPlasmaCurrencyFormatter from 'https://cdn.skypack.dev/@plasma-platform/plasma-currency-formatter';
</script>

README

Documentation

priceConversion

Price conversion from dollar to currency

Parameters

Returns number converted price with Math.round

backPriceConversion

Price conversion from currency to dollar

Parameters

Returns number converted price with Math.round

getTmLocale

Get TM locale (TM locales: en, de, es, fr, it, uk, pl, tr, cs, nl, hu, sv, pt, ar, zh, ru)

Parameters

  • locale string locale to convert to tm locale

Returns string tm locale

getCurrencyByLang

Get currency code by lang (TM currencies: USD, EUR, PLN, TRY, CNY, BRL, HUF, SEK)

Parameters

  • lang string language to get tm currency

Returns string currency code

currencyFormatter

Currency formatting by locale using Intl.NumberFormat

Parameters

Returns string formatted convertible price string