@refactorlabs/recount 0.11.0 → 0.11.1
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/index.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/llms.md +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -240,6 +240,11 @@ async function executeFetch(input, init2, recordSpan) {
|
|
|
240
240
|
|
|
241
241
|
// src/lib/decimal.ts
|
|
242
242
|
var DECIMAL = /^-?(\d+(\.\d+)?|\.\d+)$/;
|
|
243
|
+
var SIGNIFICANT_DIGITS = 15;
|
|
244
|
+
function withoutFloatNoise(n) {
|
|
245
|
+
if (!Number.isFinite(n) || Number.isInteger(n)) return n === 0 ? 0 : n;
|
|
246
|
+
return Number(n.toPrecision(SIGNIFICANT_DIGITS));
|
|
247
|
+
}
|
|
243
248
|
function decimalText(n) {
|
|
244
249
|
if (!Number.isFinite(n)) return void 0;
|
|
245
250
|
if (Object.is(n, -0) || n === 0) return "0";
|
|
@@ -1093,7 +1098,7 @@ function cleanValue(value, at, problems) {
|
|
|
1093
1098
|
);
|
|
1094
1099
|
return null;
|
|
1095
1100
|
}
|
|
1096
|
-
return
|
|
1101
|
+
return withoutFloatNoise(value);
|
|
1097
1102
|
}
|
|
1098
1103
|
if (typeof value === "string") {
|
|
1099
1104
|
return text(value, MAX_TEXT_VALUE, at, problems);
|
|
@@ -1117,7 +1122,7 @@ function operandOf(value, at, problems) {
|
|
|
1117
1122
|
problems.push(`${at}: ${value} can't be sent; sent as not calculated`);
|
|
1118
1123
|
return null;
|
|
1119
1124
|
}
|
|
1120
|
-
return
|
|
1125
|
+
return withoutFloatNoise(value);
|
|
1121
1126
|
}
|
|
1122
1127
|
if (typeof value === "string") return formulaText(value, at, problems);
|
|
1123
1128
|
const decimal = decimalObjectText(value);
|
|
@@ -1141,7 +1146,7 @@ function formulaText(formula, at, problems) {
|
|
|
1141
1146
|
}
|
|
1142
1147
|
function sizeText(value, at, problems) {
|
|
1143
1148
|
if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
|
|
1144
|
-
return decimalText(value);
|
|
1149
|
+
return decimalText(withoutFloatNoise(value));
|
|
1145
1150
|
}
|
|
1146
1151
|
const text2 = typeof value === "string" ? value.trim() : decimalObjectText(value);
|
|
1147
1152
|
if (text2 !== void 0 && isDecimalText(text2) && !text2.startsWith("-")) {
|