@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capillarytech/cap-ui-utils",
3
- "version": "1.4.15",
3
+ "version": "1.4.17",
4
4
  "description": "Utility functions shared accross all the modules",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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
  };