jashkenas/underscore — pull request #1328 by rkaw92 (2013-11-05 22:56:42+00:00)
Title: Deep-equality support in set operations (intersection, difference, uniq, union)

Added deep-compare variants of several array/set functions, which let the user operate on sets of complex objects instead of simple values. Objects can be compared by deep equality, not just by the === operator.
New versions (*Deep) of most of the functions are needed because the originals are variadic functions and modifying their arguments would lead to total API breakage.
A few basic tests are included and seem to work. Documentation is not provided (however, the functions by design have identical semantics to their shallow-comparing counterparts apart from the comparison method).

Not sure if this is the most elegant way to do it, but I did not see a more obvious method of operating on objects by value in sets.