I would like to iterate over a list of objects and get an array as the results of the items that pass a condition. Something like this:
var list = [{foo:"bar",id:0},{foo:"baz",id:1},{foo:"bar",id:2}];
async.map(list, function(item, cb) {
if (item.foo === "bar")
cb(null, item.id);
else
cb(); // do nothing
}, function(err, ids) {
console.log(ids);
});
I don't want any error callback if the condition isn't passed. Only an array with the ids of the elements.