1.3.44 • Published 3 days ago

@coinify/currency v1.3.44

Weekly downloads
250
License
MIT
Repository
github
Last release
3 days ago

node-currency

npm version

Installation

Run the following command

npm install --save @coinify/currency

Usage

const currency = require('@coinify/currency');

currency exposes the following functions:

getDecimalsForCurrency(currency)

Returns the number of decimals after the floating point, with which the amount should be formatted, depending on the currency.

fromSmallestSubunit(amount, currency)

Convert an amount of money from the smallest sub-unit of the currency to the main-unit.

toSmallestSubunit(amount, currency)

Convert an amount of money from the main-unit of the currency to the smallest sub-unit.

convertSubunitAmount(amountSubUnit, rate, fromCurrency, toCurrency)

Convert between sub-unit amounts of two currencies with a given rate, correctly converting between sub-units with different decimal amounts.

computeRateBetweenSubunitAmounts(fromCurrency, fromAmount, toCurrency, toAmount)

Computes a rate between two amounts in two different currencies.

isValidCurrency(code)

Is the provided currency code a valid currency? (fiat or crypto)

isValidFiatCurrency(code)

Is the provided currency code a valid fiat currency?

isValidCryptoCurrency(code)

Is the provided currency code a valid crypto currency?

1.3.44

3 days ago

1.3.43

2 months ago

1.3.42

3 months ago

1.3.41

4 months ago

1.3.40

4 months ago

1.3.39

4 months ago

1.3.36

10 months ago

1.3.37

7 months ago

1.3.38

7 months ago

1.3.35

11 months ago

1.3.32

1 year ago

1.3.33

1 year ago

1.3.34

1 year ago

1.3.31

1 year ago

1.3.30

2 years ago

1.3.28

2 years ago

1.3.29

2 years ago

1.3.27

2 years ago

1.3.21

2 years ago

1.3.24

2 years ago

1.3.25

2 years ago

1.3.22

2 years ago

1.3.23

2 years ago

1.3.26

2 years ago

1.3.19

2 years ago

1.3.20

2 years ago

1.3.17

3 years ago

1.3.18

2 years ago

1.3.15

3 years ago

1.3.16

3 years ago

1.3.14

3 years ago

1.3.13

3 years ago

1.3.12

3 years ago

1.3.10

3 years ago

1.3.11

3 years ago

1.3.9

3 years ago

1.3.8

3 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.2

4 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago