( originalAdjustment: HatAdjustments, newAdjustment: HatAdjustments, propertyName: keyof HatAdjustments )
| 16 | const newAdjustments: Partial<IndividualHatAdjustmentMap> = {}; |
| 17 | |
| 18 | function processProperty( |
| 19 | originalAdjustment: HatAdjustments, |
| 20 | newAdjustment: HatAdjustments, |
| 21 | propertyName: keyof HatAdjustments |
| 22 | ) { |
| 23 | const originalValue = originalAdjustment[propertyName] ?? 0; |
| 24 | const newAdjustmentValue = newAdjustment[propertyName] ?? 0; |
| 25 | const newValue = originalValue + newAdjustmentValue; |
| 26 | const value = (originalValue + newValue) / 2; |
| 27 | |
| 28 | return { |
| 29 | value: postProcessValue(value), |
| 30 | originalAdjustment: postProcessValue(originalValue - value), |
| 31 | newAdjustment: postProcessValue(newValue - value), |
| 32 | }; |
| 33 | } |
| 34 | |
| 35 | function main() { |
| 36 | const fullMap = Object.fromEntries( |
no test coverage detected