@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.js
CHANGED
|
@@ -227,6 +227,11 @@ async function executeFetch(input, init2, recordSpan) {
|
|
|
227
227
|
|
|
228
228
|
// src/lib/decimal.ts
|
|
229
229
|
var DECIMAL = /^-?(\d+(\.\d+)?|\.\d+)$/;
|
|
230
|
+
var SIGNIFICANT_DIGITS = 15;
|
|
231
|
+
function withoutFloatNoise(n) {
|
|
232
|
+
if (!Number.isFinite(n) || Number.isInteger(n)) return n === 0 ? 0 : n;
|
|
233
|
+
return Number(n.toPrecision(SIGNIFICANT_DIGITS));
|
|
234
|
+
}
|
|
230
235
|
function decimalText(n) {
|
|
231
236
|
if (!Number.isFinite(n)) return void 0;
|
|
232
237
|
if (Object.is(n, -0) || n === 0) return "0";
|
|
@@ -1080,7 +1085,7 @@ function cleanValue(value, at, problems) {
|
|
|
1080
1085
|
);
|
|
1081
1086
|
return null;
|
|
1082
1087
|
}
|
|
1083
|
-
return
|
|
1088
|
+
return withoutFloatNoise(value);
|
|
1084
1089
|
}
|
|
1085
1090
|
if (typeof value === "string") {
|
|
1086
1091
|
return text(value, MAX_TEXT_VALUE, at, problems);
|
|
@@ -1104,7 +1109,7 @@ function operandOf(value, at, problems) {
|
|
|
1104
1109
|
problems.push(`${at}: ${value} can't be sent; sent as not calculated`);
|
|
1105
1110
|
return null;
|
|
1106
1111
|
}
|
|
1107
|
-
return
|
|
1112
|
+
return withoutFloatNoise(value);
|
|
1108
1113
|
}
|
|
1109
1114
|
if (typeof value === "string") return formulaText(value, at, problems);
|
|
1110
1115
|
const decimal = decimalObjectText(value);
|
|
@@ -1128,7 +1133,7 @@ function formulaText(formula, at, problems) {
|
|
|
1128
1133
|
}
|
|
1129
1134
|
function sizeText(value, at, problems) {
|
|
1130
1135
|
if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
|
|
1131
|
-
return decimalText(value);
|
|
1136
|
+
return decimalText(withoutFloatNoise(value));
|
|
1132
1137
|
}
|
|
1133
1138
|
const text2 = typeof value === "string" ? value.trim() : decimalObjectText(value);
|
|
1134
1139
|
if (text2 !== void 0 && isDecimalText(text2) && !text2.startsWith("-")) {
|