I have a parsed query string object, req.query, and I want to see if that object has any of three keys: foo, bar, baz.
Is there an idiomatic way of querying that with Underscore and/or CoffeeScript?
# simple and direct but not very DRY:
if req.query.foo or req.query.bar or req.query.baz
..
# using the any filter combined w/ CS's in sugar:
if _(req.query).any (val, key) -> key in ['foo', 'bar', 'baz']
..
# plucking just the desired keys:
if _(req.query).pick('foo', 'bar', 'baz').keys().length
...
Is there another way better than any of these? Either way, what would you write?
How about using
pick?