diff-json
diff-json copied to clipboard
How to get an array of objects with key to show diff?
I have the following code:
var diffJson = require("diff-json")
oldArray = [
{
"id": "a",
"count": 1
},
{
"id": "b",
"count": 0
}
];
newArray = [
{
"id": "b",
"count": 1
},
{
"id": "a",
"count": 3
}
];
var diffs = diffJson.diff(oldArray, newArray);
And the result is showing as:
[Object {changes: [, ], embededKey: "$index", key: "$root", type: "update"}]
What should the call to .diff
be?
What do the other params (path, embededObjKeys, keyPath) mean?