node-rus-diff
node-rus-diff copied to clipboard
The JSON object contains an array of data returned incorrectly
var diff = require('rus-diff').diff
var config1 = require('./config1.json')
var config2 = require('./config2.json')
var a = {
bar: [
{
bar2: 2,
zz: 2
}
]
}
var b = {
bar: [
{
bar2: 2,
zz: 3
}
]
}
console.log(diff(a, b))
The program return
{ '$set': { bar: [ [Object] ] } }
so, Objects in the array can not be compared
@vxhly why not try: result=diff(a,b); then print out result.$set.bar. it is the right answer [ { bar2: 2, zz: 3 } ] .
in one word, console.log hides what u want to see.
Thank you!But I have changed one method. @xiongbinsh