sag_components 1.0.554 → 1.0.555

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.
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.isNumericValue = exports.getNumberWithCommas = exports.getFormattedValue = exports.getFormattedUnits = exports.getCurrencySign = void 0;
7
7
  const getCurrencySign = (currencyTypeToConvert, value) => {
8
8
  if (value === undefined || value === null) {
9
- return '';
9
+ return "";
10
10
  }
11
11
  if (isNaN(parseFloat(value))) {
12
- return '';
12
+ return "";
13
13
  }
14
- if (!currencyTypeToConvert) return '';
15
- let currencySign = '';
16
- const currencyFormatter = new Intl.NumberFormat('en-US', {
17
- style: 'currency',
14
+ if (!currencyTypeToConvert) return "";
15
+ let currencySign = "";
16
+ const currencyFormatter = new Intl.NumberFormat("en-US", {
17
+ style: "currency",
18
18
  currency: currencyTypeToConvert
19
19
  });
20
20
  currencySign = currencyFormatter.format(Math.abs(value)).substring(0, 1);
@@ -23,21 +23,21 @@ const getCurrencySign = (currencyTypeToConvert, value) => {
23
23
  exports.getCurrencySign = getCurrencySign;
24
24
  const getFormattedUnits = num => {
25
25
  if (num === undefined || num === null) {
26
- return '';
26
+ return "";
27
27
  }
28
28
  if (isNaN(parseFloat(num))) {
29
- return '';
29
+ return "";
30
30
  }
31
31
  if (Math.abs(num) >= 1000000000) {
32
- return 'B';
32
+ return "B";
33
33
  }
34
34
  if (Math.abs(num) >= 1000000) {
35
- return 'M';
35
+ return "M";
36
36
  }
37
37
  if (Math.abs(num) >= 1000) {
38
- return 'K';
38
+ return "K";
39
39
  }
40
- return '';
40
+ return "";
41
41
  };
42
42
  exports.getFormattedUnits = getFormattedUnits;
43
43
  const getFormattedValue = num => {
@@ -48,21 +48,24 @@ const getFormattedValue = num => {
48
48
  return null;
49
49
  }
50
50
  if (Math.abs(num) >= 1000000000) {
51
- return (num / 1000000000).toFixed(1).replace(/\.0$/, '');
51
+ return (num / 1000000000).toFixed(1).replace(/\.0$/, "");
52
52
  }
53
53
  if (Math.abs(num) >= 1000000) {
54
- return (num / 1000000).toFixed(1).replace(/\.0$/, '');
54
+ return (num / 1000000).toFixed(1).replace(/\.0$/, "");
55
55
  }
56
56
  if (Math.abs(num) >= 1000) {
57
- return (num / 1000).toFixed(1).replace(/\.0$/, '');
57
+ return (num / 1000).toFixed(1).replace(/\.0$/, "");
58
58
  }
59
- return num && num % 1 != 0 ? num.toFixed(2) : num;
59
+ if (num && num % 1 != 0) {
60
+ return num === null || num === void 0 ? void 0 : num.toFixed(2);
61
+ }
62
+ return num;
60
63
  };
61
64
  exports.getFormattedValue = getFormattedValue;
62
65
  const getNumberWithCommas = x => {
63
66
  let param = x.toString();
64
67
  const pattern = /(-?\d+)(\d{3})/;
65
- while (pattern.test(param)) param = param.replace(pattern, '$1,$2');
68
+ while (pattern.test(param)) param = param.replace(pattern, "$1,$2");
66
69
  return param;
67
70
  };
68
71
  exports.getNumberWithCommas = getNumberWithCommas;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.554",
3
+ "version": "1.0.555",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {