Node.js lodash filter()
filter object array by function
// in node or with browserify, you can require functions by category var _ = require('lodash/collection'); var people = [//from www. ja va 2 s . co m { id: 1, name: "Jim", age: 20, gender: 'm', enabled: true }, { id: 1, name: "Jim", age: 20, gender: 'm', enabled: false }, { id: 2, name: "Bob", age: 34, gender: 'm', enabled: true }, { id: 3, name: "Steve", age: 30, gender: 'm', enabled: true }, { id: 4, name: "Nancy", age: 42, gender: 'f', enabled: true }, { id: 5, name: "Frank", age: 30, gender: 'm', enabled: true }, { id: 6, name: "Larry", age: 68, gender: 'm', enabled: true } ]; var retired = _.filter(people,function(p) { return p.age > 60}); console.log(retired);