@reekon-tools/boldr-utils 1.3.6 → 1.3.7
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/README.md +8 -0
- package/dist/utils/tolerance.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,3 +10,11 @@ BOLDR Utils is a collection of types and utility functions written to be used ac
|
|
|
10
10
|
- Be consumable in Remix (Node/ESM, often using Vite or Webpack)
|
|
11
11
|
- Be written in TypeScript
|
|
12
12
|
- Be published cleanly to npm
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
To publish the package to NPM, be sure to build it. Then, run
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
npm publish --access public
|
|
20
|
+
```
|
package/dist/utils/tolerance.js
CHANGED
|
@@ -25,7 +25,7 @@ export function getToleranceColor(actualValue, target, min, max, toleranceConfig
|
|
|
25
25
|
}
|
|
26
26
|
// Calculate deviation percentage
|
|
27
27
|
const deviation = Math.abs(actualValue - target);
|
|
28
|
-
const toleranceRange = max
|
|
28
|
+
const toleranceRange = max + min; // Fixed: total tolerance range
|
|
29
29
|
const deviationPercentage = toleranceRange > 0 ? (deviation / toleranceRange) * 100 : 0;
|
|
30
30
|
// Sort thresholds by percentage to ensure correct evaluation order
|
|
31
31
|
const sortedThresholds = toleranceConfig.thresholds.sort((a, b) => a.percentage - b.percentage);
|
|
@@ -53,7 +53,7 @@ export function getToleranceColor(actualValue, target, min, max, toleranceConfig
|
|
|
53
53
|
*/
|
|
54
54
|
export function calculateDeviationPercentage(actualValue, target, min, max) {
|
|
55
55
|
const deviation = Math.abs(actualValue - target);
|
|
56
|
-
const toleranceRange = max
|
|
56
|
+
const toleranceRange = max + min; // Fixed: total tolerance range
|
|
57
57
|
return toleranceRange > 0 ? (deviation / toleranceRange) * 100 : 0;
|
|
58
58
|
}
|
|
59
59
|
/**
|