lodash object equality 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)){
}else{
}
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');
var uniqueUsers = _.uniqWith(users, _.isEqual);
Example 3: lodash map
const _quote_filter = _.map(quote_state, (val, key) => { if (val) { return key }})console.log(_quote_filter)
Example 4: get lodash
var object = { 'a': [{ 'b': { 'c': 3 } }] }; _.get(object, 'a[0].b.c');