Skip to content

Nexapp/currency-decimal-places

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

currency-decimal-places

In order to convert easily money amounts in whole integer to their original amounts. The list is based off of wikipedia

Usage

import {getDecimalPlacesForCurrency} from "@nexapp/currency-decimal-places"


const currency = "CAD" // ISO 4217 currency code (3 letters)
const decimalPlaces = getDecimalPlacesForCurrency(currency)
// decimalPlaces is 2, you can use money libraries like Dinero to convert a cent amount to the desired decimal format