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

Function diffObject

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

Source from the content-addressed store, hash-verified

21 * @return {object} differences
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

nothing calls this directly

Calls 1

changesFunction · 0.85

Tested by

no test coverage detected