If you want to compare objects in an array, you can utilize the _.isEqual function from Lodash. This function thoroughly checks all properties of the objects.
var obj = [{ 'a': 1, b: 2 },{ 'a': 3, b: 4 }];
var other = [{ 'a': 1, b: 2 }, { 'a': 3, b: 4 }];
_.isEqual(obj, other); // => true
Keep in mind that the order of elements in both arrays is crucial. For example, this will result in false:
var obj = [{ 'a': 1, b: 2 },{ 'a': 3, b: 4 }];
var other = [{ 'a': 3, b: 4 },{ 'a': 1, b: 2 }];
_.isEqual(obj, other); // => false
UPDATE
Although _.isEqual requires arrays to be in the same order for comparisons, you can use another lodash function like sortBy to handle this issue as shown below:
_.isEqual(_.sortBy(obj, 'id'), _.sortBy(other, 'id'));
This approach sorts the arrays by id first before checking their equality. You can also sort by multiple properties or a custom function if needed.