degachejs
Version:
A Tunisian utility library for working with CIN, phone numbers, addresses, and more
19 lines (18 loc) • 626 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatCurrency = void 0;
/**
* Formats a monetary amount in Tunisian Dinar
* @param amount - The amount to format
* @param options - Formatting options
* @returns formatted amount with currency symbol
*/
const formatCurrency = (amount, options = {}) => {
const formatter = new Intl.NumberFormat("ar-TN", {
style: "currency",
currency: "TND",
currencyDisplay: options.code ? "code" : options.symbol ? "symbol" : "name",
});
return formatter.format(amount);
};
exports.formatCurrency = formatCurrency;