var withPrecision = function (value, fixed) {
    var magnitude = Math.pow(10, fixed);
    return Math.floor(value * magnitude) / magnitude;
};
export var formatCurrency = function (value, currency) {
    if (currency === void 0) { currency = 'USD'; }
    var maximumFractionDigits = 2;
    var style = currency ? 'currency' : 'decimal';
    var formatter = new Intl.NumberFormat('en-US', { currency: 'USD', style: style });
    return formatter.format(withPrecision(Number.parseFloat(value || '0'), maximumFractionDigits));
};
export var getTildeGivenAmount = function (amount) {
    return amount && amount !== '0' ? '~' : '';
};
//# sourceMappingURL=formatCurrency.js.map