My collection looks like this.
var list = [{id:'12345', sequence:null}, {id:'12346', sequence:null}, {id:'12347', sequence:null}, {id:'12348', sequence:1}, {id:'12348', sequence:2}, {id:'12349', sequence:1}, {id:'12349', sequence:1}];
I am trying to get a unique list so that object with same id AND sequence will only return one of the objects (we have 2 here- {id:'12349', sequence:1})
my code
var uniqueList = _.uniq(list, function(obj) {
return obj.id && obj.sequence;
});
can we use lodash uniq like this? what is the approach to fix this issue?