grundiss at gmail.com (2019-05-26T14:07:22.416Z)
Wouldn't it be nice to have syntax like this:
```
const obj = { {firstName, lastName from user.profile}, otherData: 'other data' };
```
as a syntactic sugar for
```
const obj = {firstName: user.profile.firstName, lastName: user.profile.lastName, otherData: 'other data'};
```
Of cause at the moment we can write it in two steps:
```
const {fistName, lastName} = userProfile;
const obj = {firstName, lastName, otherData: 'other data'};
```
But why use extra variables?
Motivating example is lodash's .pick() method: https://lodash.com/docs/#pick
Wouldn't it be nice to have syntax like this: const obj = { {firstName, lastName from user.profile}, otherData: 'other data' }; as a syntactic sugar for const obj = {firstName: user.profile.firstName, lastName: user.profile.lastName, otherData: 'other data'}; Of cause at the moment we can write it in two steps: const {fistName, lastName} = userProfile; const obj = {firstName, lastName, otherData: 'other data'} But why use extra variables? Motivating example is lodash's .pick() method: https://lodash.com/docs/#pick -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190526/f85f680c/attachment.html>