multi-currency-words
Version:
Convert currency amounts to words with support for Indian and International numbering systems
18 lines (14 loc) • 549 B
JavaScript
const { convertToIndianCurrencyWords } = require("./indian");
const { convertToInternationalCurrencyWords } = require("./international");
function toWords(amount, options = {}) {
const {
style = "indian", // "indian" or "international"
currency = "Rupees",
subCurrency = "paise",
} = options;
if (style === "international") {
return convertToInternationalCurrencyWords(amount, currency, subCurrency);
}
return convertToIndianCurrencyWords(amount, currency, subCurrency);
}
module.exports = { toWords };