(dataNow: T, input: Partial<T>)
| 29 | } |
| 30 | |
| 31 | export function computeChanges<T>(dataNow: T, input: Partial<T>): Changes<T> { |
| 32 | const changes: Changes<T> = {}; |
| 33 | |
| 34 | for (const inputKey in input) { |
| 35 | if (input.hasOwnProperty(inputKey)) { |
| 36 | const inputValue = input[inputKey]!; |
| 37 | if (!isEqual(inputValue, dataNow[inputKey])) { |
| 38 | changes[inputKey] = [dataNow[inputKey], inputValue]; |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | return changes; |
| 44 | } |