@capillarytech/cap-ui-utils 1.4.15 → 1.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/formatter.js +8 -0
package/package.json
CHANGED
package/utils/formatter.js
CHANGED
|
@@ -113,6 +113,13 @@ function truncateNumber(num, places) {
|
|
|
113
113
|
return Math.trunc(num * numPower) / numPower;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
function localeBasedNumberFormatting(locale, value) {
|
|
117
|
+
const formattedValue = new Intl.NumberFormat(locale || "en-IN", {
|
|
118
|
+
maximumFractionDigits: 2,
|
|
119
|
+
}).format(value);
|
|
120
|
+
return formattedValue;
|
|
121
|
+
}
|
|
122
|
+
|
|
116
123
|
export default {
|
|
117
124
|
truncateNumber,
|
|
118
125
|
numberScaleINR,
|
|
@@ -121,4 +128,5 @@ export default {
|
|
|
121
128
|
formatNumberWithSymbol,
|
|
122
129
|
camelize,
|
|
123
130
|
snakeCaseToCamelCase,
|
|
131
|
+
localeBasedNumberFormatting,
|
|
124
132
|
};
|