Currencynet is a javascript light library that helps to convert currency between different html tags
npm i currencynetor
yarn add currencynetCreate 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
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>
)
}<CurrencyNet buildCurrency="USD" value={10} isfloat={false} shortenCurrency={true}/>coming soonFor all Example visit here
For all Example result visit here
| 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
- Making a google web crawler to make the application use it own personal currency converter
- Fix Documentation UI