UNPKG

infinity-forge

Version:
24 lines 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatNumberToCurrency = formatNumberToCurrency; exports.formatNumberToCurrencyISO = formatNumberToCurrencyISO; function formatNumberToCurrency(money, noIcon, options) { return Number(money) .toLocaleString((options === null || options === void 0 ? void 0 : options.local) || 'pt-BR', { minimumFractionDigits: 2, style: 'currency', currency: (options === null || options === void 0 ? void 0 : options.currency) || 'BRL', }) .replaceAll(noIcon ? (options === null || options === void 0 ? void 0 : options.icon) || 'R$' : '', ''); } function formatNumberToCurrencyISO(money, noIcon, options) { return Number(money) .toLocaleString((options === null || options === void 0 ? void 0 : options.local) || 'pt-BR', { minimumFractionDigits: 2, style: 'currency', currency: (options === null || options === void 0 ? void 0 : options.currency) || 'BRL', currencyDisplay: 'code', }) .replace(noIcon ? (options === null || options === void 0 ? void 0 : options.icon) || 'R$' : '', ''); } //# sourceMappingURL=format-number-to-currency.js.map