Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haifahrul/react-native-currency-formatter
Javascript Currency Formatter. Has implemented in React Native version 0.53.0
https://github.com/haifahrul/react-native-currency-formatter
javascript nodejs react-js react-native
Last synced: 1 day ago
JSON representation
Javascript Currency Formatter. Has implemented in React Native version 0.53.0
- Host: GitHub
- URL: https://github.com/haifahrul/react-native-currency-formatter
- Owner: haifahrul
- License: gpl-2.0
- Created: 2018-09-08T17:47:58.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-18T15:02:49.000Z (about 6 years ago)
- Last Synced: 2024-09-18T03:37:23.324Z (10 days ago)
- Topics: javascript, nodejs, react-js, react-native
- Language: JavaScript
- Size: 15.6 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-currency-formatter
## Javascript - React Native
### Currency Formatter Rupiah Indonesia and US Dollar
-------------------------This is the JavaScript widget used only IDR and USD, you can change according to your needs.
If you use for IDR, the value or price is automatically round a number upward to its nearest integer:This widget has implemented in React Native version 0.53.0.
# HOW TO USE
#### Installation
`npm i react-native-currency-formatter`#### Configuration
> Config the currency
```
const currencyCode = 'IDR '; // IDR or USD
const currencyPosition = 'left' // left or right
const maxFractionDigits = 2;
const decimalSeparator = ',';
const thousandSeparator = '.';
```#### Usage
- Create file CurrencyFormatter in your folder project.
- import in your components
`import CurrencyFormatter from '_YOUR_ROOT_FILE/CurrencyFormatter';`
- call the formatter
`${ CurrencyFormatter(value_of_price) }`# EXAMPLE
##### For IDR (Indonesian Rupiah)
- `${ CurrencyFormatter(1234511) }`
- Result `IDR 1.234.511`##### For US Dollar
- `${ CurrencyFormatter(1234511.47) }`
- Result `IDR 1,234,511.47`