phx-react
Version:
PHX REACT
17 lines • 604 B
JavaScript
const formatNumber = (number, locale, option) => {
var _a;
return new Intl.NumberFormat(locale !== null && locale !== void 0 ? locale : 'VND', {
...option,
currency: (_a = option === null || option === void 0 ? void 0 : option.currency) !== null && _a !== void 0 ? _a : 'VND',
}).format(number);
};
function toVND(n) {
return new Intl.NumberFormat('vi-VN', {
style: 'currency',
currency: 'VND',
minimumFractionDigits: 0,
maximumFractionDigits: 4,
}).format(n);
}
export { toVND, formatNumber };
//# sourceMappingURL=format-number.js.map