MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / buildCompareTone

Function buildCompareTone

tests/loadtest/tools/dashboard/app.js:1086–1108  ·  view source on GitHub ↗
(leftValue, rightValue, formatter = (value) => String(value))

Source from the content-addressed store, hash-verified

1084}
1085
1086function buildCompareTone(leftValue, rightValue, formatter = (value) => String(value)) {
1087 const changed = valuesDiffer(leftValue, rightValue, formatter);
1088 let deltaClass = "delta-pill delta-pill-neutral";
1089
1090 if (changed) {
1091 if (!hasValue(leftValue) && hasValue(rightValue)) {
1092 deltaClass = "delta-pill delta-pill-added";
1093 } else if (hasValue(leftValue) && !hasValue(rightValue)) {
1094 deltaClass = "delta-pill delta-pill-removed";
1095 } else if (Number.isFinite(leftValue) && Number.isFinite(rightValue)) {
1096 deltaClass = rightValue >= leftValue ? "delta-pill delta-pill-added" : "delta-pill delta-pill-removed";
1097 } else {
1098 deltaClass = "delta-pill delta-pill-changed";
1099 }
1100 }
1101
1102 return {
1103 changed,
1104 leftClass: changed && hasValue(leftValue) ? "diff-removed" : "",
1105 rightClass: changed && hasValue(rightValue) ? "diff-added" : "",
1106 deltaClass,
1107 };
1108}
1109
1110function mergeByLabel(leftItems, rightItems, getLabel) {
1111 const map = new Map();

Callers 5

renderCompareThresholdsFunction · 0.85
renderCompareChecksFunction · 0.85
compareBarChartFunction · 0.85
compareMetricRowFunction · 0.85
compareSummaryCardFunction · 0.85

Calls 2

valuesDifferFunction · 0.85
hasValueFunction · 0.85

Tested by

no test coverage detected