Lodash Where Inclusive Or
Joining together multiple _.where() filters with an "inclusive or" condition.
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
JavaScript
$(function() {
// Bogus sample data.
var data = [
{ age: 23, gender: "male" },
{ age: 25, gender: "female" },
{ age: 25, gender: "male", active: true },
{ age: 26, gender: "female" },
{ age: 23, gender: "male" },
{ age: 25, gender: "female", active: true }
];
// With help from _.uniq(), we can join together
// multiple _.where() conditions as though they
// were "inclusive or"ed together.
alert(1);
result = _.where (data,{"gender":"male"})
alert(JSON.stringify(result))
});