(leftItems, rightItems, getLabel)
| 1108 | } |
| 1109 | |
| 1110 | function mergeByLabel(leftItems, rightItems, getLabel) { |
| 1111 | const map = new Map(); |
| 1112 | leftItems.forEach((item) => { |
| 1113 | const label = getLabel(item); |
| 1114 | map.set(label, { label, left: item, right: null }); |
| 1115 | }); |
| 1116 | rightItems.forEach((item) => { |
| 1117 | const label = getLabel(item); |
| 1118 | if (map.has(label)) { |
| 1119 | map.get(label).right = item; |
| 1120 | } else { |
| 1121 | map.set(label, { label, left: null, right: item }); |
| 1122 | } |
| 1123 | }); |
| 1124 | return [...map.values()]; |
| 1125 | } |
| 1126 | |
| 1127 | function compareMetricRow(label, leftValue, rightValue, formatter) { |
| 1128 | const tone = buildCompareTone(leftValue, rightValue, formatter); |
no outgoing calls
no test coverage detected