can-diff/map/map
Return a difference of two maps or objects.
diffMap(oldObject, newObject)
Find the differences between two objects, based on properties and values.
var diffObject = require("can-diff/map/map");
diffMap({a: 1, b: 2}, {b: 3, c: 4})) // ->
[{key: "a", type: "remove"},
{key: "b", type: "set": value: 3},
{key: "c", type: "add", "value": 4}]
Parameters
- oldObject
{Object}
:The object to diff from.
- newObject
{Object}
:The object to diff to.
Returns
{Array}
:
An array of object-patch objects
The object-patch object format has the following keys:
- type: the type of operation on this property: add, remove, or set
- key: the mutated property on the new object
- value: the new value (if type is "add" or "set")