@fatehan/tsrp 1.3.34 → 1.3.36

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.
@@ -1 +1 @@
1
- {"version":3,"file":"system.io.d.ts","sourceRoot":"","sources":["../src/system.io.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,QAAQ,EAET,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEnD,QAAA,MAAM,YAAY,GAChB,UAAU,QAAQ,EAAE,EACpB,UAAU,QAAQ,EAAE,EACpB,MAAM,IAAI,KACT,OAAO,EA4FT,CAAC;AAuBF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"system.io.d.ts","sourceRoot":"","sources":["../src/system.io.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,QAAQ,EAET,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEnD,QAAA,MAAM,YAAY,GAChB,UAAU,QAAQ,EAAE,EACpB,UAAU,QAAQ,EAAE,EACpB,MAAM,IAAI,KACT,OAAO,EAoGT,CAAC;AA6BF,eAAe,YAAY,CAAC"}
package/dist/system.io.js CHANGED
@@ -11,6 +11,7 @@ const SystemIoCast = (systemIo, deviceIo, data) => {
11
11
  }
12
12
  const tempSystemIo = [...systemIo, ...deviceIo].sort((a, b) => a.sord - b.sord);
13
13
  tempSystemIo.forEach((io) => {
14
+ var _a;
14
15
  let items = extractVariables(io.formula);
15
16
  let formula = io.formula;
16
17
  let hasIos = true;
@@ -43,7 +44,7 @@ const SystemIoCast = (systemIo, deviceIo, data) => {
43
44
  }
44
45
  }
45
46
  else {
46
- if (newValue.toString().equals(key)) {
47
+ if (newValue.toString().includes(key)) {
47
48
  newValue = io.unknown[key];
48
49
  }
49
50
  }
@@ -58,18 +59,27 @@ const SystemIoCast = (systemIo, deviceIo, data) => {
58
59
  }
59
60
  }
60
61
  else {
61
- if (newValue.toString().equals(item)) {
62
+ if (newValue.toString().includes(item)) {
62
63
  hidden = true;
63
64
  }
64
65
  }
65
66
  });
67
+ if (io.DecimalCount && io.DecimalCount > 0) {
68
+ newValue = Number(newValue).toFixed(io.DecimalCount);
69
+ }
70
+ else if (io.DecimalCount === 0) {
71
+ newValue = Math.round(newValue).toString();
72
+ }
73
+ if (io.SeparatorsCount && io.SeparatorsCount > 0) {
74
+ newValue = Separator(String(newValue), (_a = io.SeparatorsCount) !== null && _a !== void 0 ? _a : 0);
75
+ }
66
76
  if (!hidden) {
67
77
  list.push({
68
78
  name: io.name,
69
79
  style: style,
70
80
  unit: io.unit,
71
81
  description: io.description,
72
- value: newValue,
82
+ value: String(newValue),
73
83
  active: io.active,
74
84
  graphable: io.graphable,
75
85
  sord: io.sord,
@@ -79,6 +89,12 @@ const SystemIoCast = (systemIo, deviceIo, data) => {
79
89
  });
80
90
  return list;
81
91
  };
92
+ function Separator(value, seprator) {
93
+ const [intPart, decimalPart] = value.split(".");
94
+ const regex = new RegExp(`\\B(?=(\\d{${seprator}})+(?!\\d))`, "g");
95
+ const formattedInt = intPart.replace(regex, ",");
96
+ return decimalPart ? `${formattedInt}.${decimalPart}` : formattedInt;
97
+ }
82
98
  function extractVariables(str) {
83
99
  const matches = str.match(/\$(\w+(?:\.\w+)*)/g);
84
100
  if (!matches)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fatehan/tsrp",
3
- "version": "1.3.34",
3
+ "version": "1.3.36",
4
4
  "description": "fatehan main models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",