1

If one property value of both objects is same it setting to null or empty, but I don't want to set anything if both property values are same. How do I do that?

obj1 = { name: 'red', age: 12 }
obj2 = { name: 'yellow' age: 12 }

jsonPatch.compare(obj1, obj2);

Output:

{ op: "replace", path: "/Name", value: "yellow"},

{ op: "replace", path: "/age", value: ""},

I don't want to update age if it is same

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122

0 Answers0