@allenheltondev
Hello,
Thank you for your help. Unfortunately doesn’t work neither
json1 = {
"a": 1,
"b": {"toto" : "toto",
"array" : [
{"old": {
"value" :1
}},
{"new": {
"value" :2
}}
]
}
}
json2 = {
"a": 1,
"b": {"toto" : "toto",
"array" : [
{"new": {
"value" :2
}},
{"old": {
"value" :1
}}
]
}
}
json3 = {
"b": {"toto" : "toto",
"array" : [
{"old": {
"value" :1
}},
{"new": {
"value" :2,
"other" : 4
}}
]
},
"a": 1
}
function customizer(baseValue, value) {
if (Array.isArray(baseValue) && Array.isArray(value)) {
return lodash.isEqual(lodash.sortBy(baseValue), lodash.sortBy(value))
}
}
console.log(lodash.isEqualWith(json1,json2,customizer)) -> false (I expected true as only array order changes)
console.log(lodash.isEqual((lodash.sortBy(json1),lodash.sortBy(json2)))) -> same as above
console.log(lodash.xor(json1, json2).length) -> 0
console.log(lodash.xor(json1, json3).length) -> 0 (I expected different than 0 because of "other" in json3)
Thank you for your assistance. Any idea?
Best regards