In my application i have an array like this :
var arr=[
{id:1,name:"mohammmad",deny:false},
{id:1,name:"mohammmad",deny:false},
{id:1,name:"mohammmad",deny:true},
{id:2,name:"ali",deny:false},
{id:3,name:"reza",deny:true},
{id:2,name:"ali",deny:true}
];
now I want to return unique collection of this array based on id of object but if collection have true value for deny it must return the object that have deny=true. for example :
{id:1,name:"mohammmad",deny:false},
{id:1,name:"mohammmad",deny:false},
{id:1,name:"mohammmad",deny:true},
it filter with id=1 but return the object that have deny=true.
i also create a jsbin here .
deny:true, onlydeny:false? What I'm really asking is, can we just remove anything that isdeny:falseand filter the rest ?deny:falseuniqit will filter the duplicates.