JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
JavaScript
var people = [{firstName : "Thein", city : "ny", qty : 5},{firstName : "Michael", city : "ny", qty : 3}, {firstName : "Bloom", city : "nj", qty : 10} ];
var results = _.map(
_.where(people, {city : "ny"}),
function(person) {
return { firstName: person.firstName, qty: person.qty };
}
);
console.log(results);
console.log(JSON.stringify(results));