currencynet
v2.0.8
Published
A simple currency manager for the net project
Downloads
27
Maintainers
Readme
CUURENCYNET REACT VERSION
Currencynet is a javascript light library that helps to convert currency between different html tags
Documentation : Usage
Installing Currencynet
npm i currencynet
or
yarn add currencynet
Import Currencynet
Create a new currencyNet Object
import { CurrencyNet } from 'currencynet'
Now add your the CurrencyNet
jsx element
<CurrencyNet buildCurrency="USD" value={10} isfloat={false} shortenCurrency={true} />
buildCurrency
- This can be replaced by any of ISO 4217 CODE based on the currency used in that element
value
- This is the value of the element in your build currency
isfloat
- (optional) - This is an optional parameter that determine if the currency should be returned as a float or not , default
is true
shortenCurrency
- (optional) - This is an optional param for formatting currencies in shorten form e.g $1200
becomes $1.2k
Using it in a Component
As seen we will always have to redeclare the buildCurrency
when using it in a component which can be very exhausting , so for best pratice you can create a default component to be used through out your application
import React from 'react'
import {CurrencyNet} from 'currencynet'
//Using props
const MyDollarCurrency = (props) => {
return (
<CurrencyNet buildCurrency="USD" value={props.value} />
)
}
// Using Children
const MyEuroCurrency = ({children}) => {
return (
<CurrencyNet buildCurrency="EUR" value={Number(children)} />
)
}
export default const App = () => {
return (
<div class="App">
<MyDollarCurrency value={10} />
<MyEuroCurrency>
10
</MyEuroCurrency>
</div>
)
}
New Currency Formatter
<CurrencyNet buildCurrency="USD" value={10} isfloat={false} shortenCurrency={true}/>
Adding a dropdown option
coming soon
For all Example visit here
For all Example result visit here
Table for all avaliable currency class
| COUNTRY | ISO 4217 CODE | CLASSNAME | | :---: | :---:| :---| | US Dollar | USD | currencynet-init-usd | | Indian Rupee | INR | currencynet-init-inr | | Euro | EUR | currencynet-init-eur | | Chinese Yuan | CYN | currencynet-init-cyn | | Nigerian Naira| NGN | currencynet-init-ngn |
more are avaliable at our documentation
TODO
- [ ] Making a google web crawler to make the application use it own personal currency converter
- [ ] Fix Documentation UI