我試圖從具有4個相同值和1個唯一的數組中刪除對象。從數組中刪除類似的對象
甲快速谷歌搜索給出很多選擇用於從陣列中除去相同對象,但不是說是類似對象。陣列的
實施例:
var data = [
{Date: "2016-04-27T09:03:45Z", Name: "Tito", Title: "Developer", Department:"IT", Company: "XXX"},
{Date: "2016-04-27T08:07:45Z", Name: "Tito", Title: "Developer", Department:"IT", Company: "XXX"},
{Date: "2016-04-27T10:23:45Z", Name: "Tito", Title: "Developer", Department:"IT", Company: "XXX"}
]
我已經使用lodash _uniq
功能嘗試,但只需要一個屬性匹配:
var non_duplidated_data = _.uniq(data, 'Name');
所有值均爲除日期相同。我如何根據4個屬性刪除相同的對象?
可能重複[下劃線/ lodash唯一的多個屬性](http://stackoverflow.com/questions/26306415/underscore-lodash-unique-by-multiple-properties) – DhruvPathak
請考慮接受答案 – Manticore