chore(medusa-core-utils): Migrate to TS (#2670)

This commit is contained in:
Adrien de Peretti
2022-12-05 10:21:04 +01:00
committed by GitHub
parent 1dc816039c
commit 1b21af87ab
23 changed files with 254 additions and 233 deletions
@@ -0,0 +1,13 @@
import zeroDecimalCurrencies from "./zero-decimal-currencies"
const computerizeAmount = (amount: number, currency: string): number => {
let divisor = 100
if (zeroDecimalCurrencies.includes(currency.toLowerCase())) {
divisor = 1
}
return Math.round(amount * divisor)
}
export default computerizeAmount