@carbon/ibm-products
Version:
Carbon for IBM Products
29 lines (27 loc) • 882 B
JavaScript
/**
* Copyright IBM Corp. 2020, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
//#region src/components/BigNumber/constants.ts
const DefaultLocale = "en-US";
const formatValue = (locale, value, fractionDigits, truncate) => {
if (value === null || value === void 0 || typeof value !== "number") return null;
return truncate ? Intl.NumberFormat(locale, {
notation: "compact",
minimumFractionDigits: fractionDigits,
maximumFractionDigits: Math.round(fractionDigits)
}).format(value) : Intl.NumberFormat(locale).format(value);
};
const getIconSize = (size) => {
switch (size) {
case "lg": return 20;
case "xl": return 24;
default: return 16;
}
};
//#endregion
exports.DefaultLocale = DefaultLocale;
exports.formatValue = formatValue;
exports.getIconSize = getIconSize;