befly 3.16.8 → 3.16.9

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/dist/befly.js CHANGED
@@ -101,6 +101,22 @@ function isFiniteNumber(value) {
101
101
  function isIntegerNumber(value) {
102
102
  return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value);
103
103
  }
104
+ function canConvertToNumber(value) {
105
+ const maxSafe = BigInt(Number.MAX_SAFE_INTEGER);
106
+ const minSafe = BigInt(Number.MIN_SAFE_INTEGER);
107
+ if (value > maxSafe || value < minSafe) {
108
+ return null;
109
+ }
110
+ const asNumber = Number(value);
111
+ if (!Number.isSafeInteger(asNumber)) {
112
+ return null;
113
+ }
114
+ const text = String(asNumber);
115
+ if (text.includes("e") || text.includes("E")) {
116
+ return null;
117
+ }
118
+ return asNumber;
119
+ }
104
120
  function formatValuePreview(value) {
105
121
  if (value === null) {
106
122
  return "null";
@@ -15480,8 +15496,9 @@ class DbHelper {
15480
15496
  }
15481
15497
  }
15482
15498
  if (bigintValue !== null) {
15483
- if (bigintValue <= MAX_SAFE_INTEGER_BIGINT && bigintValue >= MIN_SAFE_INTEGER_BIGINT) {
15484
- nextValue = Number(bigintValue);
15499
+ const convertedNumber = canConvertToNumber(bigintValue);
15500
+ if (convertedNumber !== null) {
15501
+ nextValue = convertedNumber;
15485
15502
  }
15486
15503
  }
15487
15504
  }