MCPcopy
hub / github.com/deepops-ai/deepops / changes

Function changes

ui/src/utils/diff.ts:24–32  ·  view source on GitHub ↗
(newObj, origObj)

Source from the content-addressed store, hash-verified

22 */
23export function diffObject(origObj, newObj) {
24 function changes(newObj, origObj) {
25 let arrayIndexCounter = 0
26 return transform(newObj, function (result, value, key) {
27 if (!isEqual(value, origObj[key])) {
28 let resultKey = isArray(origObj) ? arrayIndexCounter++ : key
29 result[resultKey] = (isObject(value) && isObject(origObj[key])) ? changes(value, origObj[key]) : value
30 }
31 })
32 }
33 return changes(newObj, origObj)
34}

Callers 1

diffObjectFunction · 0.85

Calls 1

isObjectFunction · 0.50

Tested by

no test coverage detected