jashkenas/underscore — pull request #1709 by Timothee (2014-06-27 20:32:19+00:00)
Title: Add ability to rename keys when calling _.pick

Typically, `_.pick` takes an object and a list of keys and returns an
object with just these keys and their values.

However, often times, I need some keys to be renamed. E.g. when getting
a few attributes from one model to send to the API of another model. (I'm
talking Backbone models, but it would apply to anything of course)

Right now, I would do something like that:

```js
var modelAttr = _.pick(myUser, 'id', 'name');
modelAttr.userEmail = myUser.get('email');

// => {id: '1234', name: 'Jane Doe', userEmail: 'jane@doe.org'}
```

What I'm suggesting is being able to rename keys if needed, like so:

```js
var modelAttr = _.pick(myUser, 'id', 'name', {email: 'userEmail'});

// => {id: '1234', name: 'Jane Doe', userEmail: 'jane@doe.org'}
```

I also changed `_.omit` since it mirrors what `_.pick` does and both
could be used with the same options to get the complements of each
other. Of course, in this case, the object values are unused.