underscore/lodash unique by multiple properties
I have an array of objects with duplicates and I'm trying to get a unique listing, where uniqueness is defined by a subset of the properties of the object. For example, {a:"1",b:"1",c:"2"} And I want to ignore c in the uniqueness comparison. I can do something like _.uniq(myArray,function(element) { return element.a + "_" + element+b}); I was hoping I could do _.uniq(myArray,function(element) { return {a:element.a, b:element.b} }); But that doesn't work. Is there something like that I can do, or do I need to create a comparable representation of the object if I'm comparing multiple properties?