MCPcopy Create free account
hub / github.com/clientdb/clientdb / computeChanges

Function computeChanges

core/utils/changes.ts:31–44  ·  view source on GitHub ↗
(dataNow: T, input: Partial<T>)

Source from the content-addressed store, hash-verified

29}
30
31export 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}

Callers 1

updateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected