@maz-ui/utils
Version:
Utils of maz-ui for JavaScript/TypeScript users
24 lines (23 loc) • 608 B
JavaScript
const u = {
minimumFractionDigits: 2
};
function m(t, r, e) {
const i = {
...u,
...e
};
if (t === void 0)
throw new TypeError("[maz-ui](FilterNumber) The `number` attribute is required.");
if (r === void 0)
throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute is required.");
if (typeof r != "string")
throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute must be a string.");
try {
return new Intl.NumberFormat(r, i).format(Number(t));
} catch (o) {
throw new Error(`[maz-ui](FilterNumber) ${o}`);
}
}
export {
m as formatNumber
};