lodash/lodash — pull request #764 by EtaiG (2014-11-01 21:42:26+00:00)
Title: Adding support for `where` style callbacks in _.pick

I often find that I want to pick items from an object-collection (hashmap), which contain specific properties.
_.where would work except that it returns an array, and then I lose the key (hash) from the key:value pairs I was comparing.

For example (this is the test I added):
```
var collection = {
'obj1': {'a': 1, 'b': 2},
'obj2': {'a': 5, 'b': 2, 'c': 3},
'obj3': {'a': 1, 'b': 2, 'c': 3},
'obj4': {'a': 1, 'b': 4, 'c': 3}
};

deepEqual(_.pick(collection, {'a': 1}), _.pick(collection, ['obj1', 'obj3', 'obj4']));
deepEqual(_.pick(collection, {'a': 1, 'c': 3}), _.pick(collection, ['obj3', 'obj4']));
```

This is aligned with the rest of the lodash API for collections, which usually support the _.where style callback.
I find that it is also useful when chaining, in conjunction with other functions which work on object-collections, and supports better composability.

For example, with mapValues:
```
_(linksData)
.pick({dataType: 'AnchorLink'})
.mapValues(function(obj){
return doSomething(obj);
}).value();
//returns mapped values of only 'AnchorLink' type.
```

What do you think?