lodash deep compare code example
Example 1: lodash deep compare two objects
var bob = {"sex":"male","age":21};
var bill = {"sex":"male","age":21};
if(_.isEqual(bob, bill)){
//we are equal
}else{
//we are not equal
}
Example 2: Lodash remove duplicates from array
var users = [
{id:1,name:'ted'},
{id:1,name:'ted'},
{id:1,name:'bob'},
{id:3,name:'sara'}
];
var uniqueUsersByID = _.uniqBy(users,'id'); //removed if had duplicate id
var uniqueUsers = _.uniqWith(users, _.isEqual);//removed complete duplicates