Example 1 — Official: Deep Equal With _.isEqual
Keep first-list objects that deeply equal an item in every other list.
var objects = [{ x: 1, y: 2 }, { x: 2, y: 1 }];
var others = [{ x: 1, y: 1 }, { x: 1, y: 2 }];
_.intersectionWith(objects, others, _.isEqual);
// → [{ x: 1, y: 2 }] How It Works
- Comparator.
_.isEqualchecks deep structural equality. - First object. Matches
{ x: 1, y: 2 }in others → kept. - Second object. No deep match → skipped.
- Reference. Result keeps the object from
objects, notothers.

