make-currency
Version:
[](https://www.npmjs.com/package/make-currency) [](https://www.npmjs.com/package/make-currency)
66 lines (48 loc) • 3.07 kB
Markdown
# `Make Currency`
[](https://www.npmjs.com/package/make-currency) [](https://www.npmjs.com/package/make-currency)
| Statements | Branches | Functions | Lines |
|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
|  |  |  |  |
---
Work with price values in JavaScript in a simplified way.\
Support for USD and BRL
## Installing
Using npm:
```sh
npm install make-currency
```
Using yarn:
```sh
yarn add make-currency
```
Using jsDelivr CDN:
```html
<script src="https://cdn.jsdelivr.net/npm/make-currency/dist/make.min.js"></script>
```
Using unpkg CDN:
```html
<script src="https://unpkg.com/make-currency/dist/make.min.js"></script>
```
## Usage
* [Vanilla JS](https://stackblitz.com/edit/vanillajs-make-currency) → [Preview](https://vanillajs-make-currency.stackblitz.io/)
* [React](https://stackblitz.com/edit/react-make-currency) → [Preview](https://react-make-currency.stackblitz.io/)
## Display currency values
In the current version BRL for `floatValue` or `stringValue`
| typed | input value | float value | string value |
|------------ |--------------- |------------- |--------------- |
| | 0,00 | 0.00 | 0,00 |
| 1 | 0,01 | 0.01 | 0,01 |
| 12 | 0,12 | 0.12 | 0,12 |
| 123 | 1,23 | 1.23 | 1,23 |
| 1234 | 12,34 | 12.34 | 12,34 |
| 12345 | 123,45 | 123.45 | 123,45 |
| 123456 | 1.234,56 | 1234.56 | 1.234,56 |
| 1234567 | 12.345,67 | 12345.67 | 12.345,67 |
| 12345678 | 123.456,78 | 123456.78 | 123,456,78 |
| 123456789 | 1.234.567,89 | 1234567.89 | 1.234.567,89 |
## Announcement
en: `More coins will be available soon!`
pt: `Em breve mais moedas estará disponível!`
es: `¡Más monedas estarán disponibles pronto!`
## Issues
Feel free to raise an issue on Github if you find a bug or have a feature request