I am trying to compare two objects with Lodash. One is getting as input and the other one is from db.Below is my method.
console.log(`isDataChanged - fromDbData : ${JSON.stringify(fromDbData)}`);
console.log(`isDataChanged - inputData : ${JSON.stringify(inputData)}`);
if(_.isEqual(fromDbData, inputData)){
console.log("isDataChanged - equal data found");
return false;
}else{
console.log("isDataChanged - different data found");
return true;
}
};
the object is looks like below
{
...
"data": {
"type": "Date",
"name": "test",
"tag": "sample",
"category": null,
"time": null,
"caption": "the caption",
"value": "none"
}
}
As the input parameter i’m sending the data property of both objects.
So when the values inside the data object for both I am expecting false. But it’s returning true.
Can someone please help me to understand what’s happening here?
Thanks!