I have a collection of objects
var array =
[
{"category":"A", "categoryname":"somename", key: 1, description: "something"},
{"category":"A", "categoryname":"somename", key: 1, description: "something"},
{"category":"B", "categoryname": "somename", key: 1, description: "something"}
{"category":"B", "categoryname": "somename", key: 3, description: "something"}
{"category":"C", "categoryname": "somename", key: 2, description: "something"}
{"category":"C", "categoryname": "somename", key: 2, description: "something"}
]
that have 4 values (category, categoryname, key, description) and I need to loop through it and get a unique list of objects based on the category. But I want to return the unique list with 2 preoperties and not just one. If I use
_.uniq(_.pluck(array,"category"))
this gives me what I want except I need the categoryname as well as the category. Is this possible?