2.0.8 • Published 3 years ago

currencynet v2.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

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

COUNTRYISO 4217 CODECLASSNAME
US DollarUSDcurrencynet-init-usd
Indian RupeeINRcurrencynet-init-inr
EuroEURcurrencynet-init-eur
Chinese YuanCYNcurrencynet-init-cyn
Nigerian NairaNGNcurrencynet-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
1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.8

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago