zero-decimal-currencies
Get the smallest currency unit event to a Zero Decimal Currency
Features
Get the smallest currency unit event to a Zero Decimal Currency
This lib with convert the amount in the smallest currency unit (e.g., 100 cents to charge €1.00 or 100 to charge ¥100, a zero-decimal currency).
Install
npm install zero-decimal-currencies
Usage
const smallestUnit = require('zero-decimal-currencies');
let amount = smallestUnit(100.01, 'JPY');
console.log(amount);
let amount2 = smallestUnit(100.01, 'JPY', true);
console.log(amount2);
let amount3 = smallestUnit(100.51, 'JPY');
console.log(amount3);
let amount4 = smallestUnit(100.01, 'EUR');
console.log(amount4);
let amount5 = smallestUnit(100.01, 'EUR', true);
console.log(amount5);
let amount6 = smallestUnit(15.7784514, 'EUR');
console.log(amount6);
let amount7 = smallestUnit(15.7784514, 'EUR', false, true);
console.log(amount7);
Author
Kelvin Campelo kelvsousa@gmail.com https://github.com/KelvinCampelo
License
Contributing
Contributions are highly welcome! This repo is commitizen friendly — please read about it here.