npm package: @plasma-platform/currency-formatter
Description: Currency formatting depending on locale
Author: Kyrylo Voronoi
Latest version: 1.1.0

![version](https://badgen.net/npm/v/@plasma-platform/currency-formatter)
![nextVersion](https://badgen.net/npm/v/@plasma-platform/currency-formatter/next)
![downloads](https://badgen.net/npm/dt/@plasma-platform/currency-formatter)
![license](https://badgen.net/npm/license/@plasma-platform/currency-formatter)
![dependency](https://badgen.net/npm/dependents/@plasma-platform/currency-formatter)  

* * *

[Full documentation](https://templatemonster.gitlab.io/PlasmaPlatform/Frontend/plasma-platform/?path=/story/plasma-platform-currency-formatter)  
install:  
`npm i @plasma-platform/currency-formatter -S`  

# Short documentation

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [priceConversion](#priceconversion)
    -   [Parameters](#parameters)
-   [backPriceConversion](#backpriceconversion)
    -   [Parameters](#parameters-1)
-   [getTmLocale](#gettmlocale)
    -   [Parameters](#parameters-2)
-   [getCurrencyByLang](#getcurrencybylang)
    -   [Parameters](#parameters-3)
-   [currencyFormatter](#currencyformatter)
    -   [Parameters](#parameters-4)

## priceConversion

Price conversion from dollar to currency

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.price` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** price by dollar
    -   `params.rate` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** currency rate
    -   `params.roundingType` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** type of rounding

Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** converted price with Math.round

## backPriceConversion

Price conversion from currency to dollar

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.price` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** price by currency
    -   `params.rate` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** currency rate
    -   `params.roundingType` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** type of rounding

Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** locale to convert to tm locale

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** tm locale

## getCurrencyByLang

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

### Parameters

-   `lang` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** language to get tm currency

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** currency code

## currencyFormatter

Currency formatting by locale using Intl.NumberFormat

### Parameters

-   `price` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** 
-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.locale` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
    -   `params.currencyRate` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
    -   `params.currency` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
    -   `params.currencyDisplay` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
    -   `params.useGrouping` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
    -   `params.minimumIntegerDigits` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** 
    -   `params.minimumFractionDigits` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** 
    -   `params.maximumFractionDigits` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** 

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** formatted convertible price string