"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat
*
* * * This function require "Intl.NumberFormat" in global scope.
* * Please see polyfill/polyfillIntl if you need a polyfill of that.
* @category number
* @module formatCurrency
*/
var formatCurrency = function (numToFormat, locales, _a) {
if (numToFormat === void 0) { numToFormat = 0; }
if (locales === void 0) { locales = []; }
var _b = _a === void 0 ? {} : _a, _c = _b.currency, currency = _c === void 0 ? 'hkd' : _c, _d = _b.minimumFractionDigits, minimumFractionDigits = _d === void 0 ? 2 : _d, _e = _b.minimumIntegerDigits, minimumIntegerDigits = _e === void 0 ? 1 : _e;
var formatter = new Intl.NumberFormat(locales, {
style: 'currency',
currency: currency.toUpperCase(),
minimumFractionDigits: minimumFractionDigits,
minimumIntegerDigits: minimumIntegerDigits,
});
return formatter.format(numToFormat);
};
exports.default = formatCurrency;
Source