guest271314 (2019-06-02T00:27:52.000Z)
```from``` implementation using JavaScript

```
const user = {profile:{firstName:"00", lastName:"11"}};
const from = (o, ...props) =>
Object.fromEntries(Object.entries(o).filter(([key]) =>
props.includes(key)));
let obj = {otherData:'other data',...from(user.profile, "firstName")};
```

which should be possible to code as

```
const user = {profile:{firstName:"00", lastName:"11"}};
 // preserve right-side/last value syntax to avoid confusion
let obj = {otherData:'other data',...{ from user.profile {firstName} }};
```

or, similar to
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Assigning_to_new_variable_names

```
const user = {profile:{firstName:"00", lastName:"11"}};
let obj = {otherData:'other data'};
({firstName /* , lastName, ...props */} from user.profile to obj);
```



On Sun, May 26, 2019 at 1:40 PM Григорий Карелин <grundiss at gmail.com> wrote:

> 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
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190602/3b602346/attachment.html>
guest271314 at gmail.com (2019-06-02T00:32:27.976Z)
```from``` implementation using JavaScript

```
const user = {profile:{firstName:"00", lastName:"11"}};
const from = (o, ...props) => Object.fromEntries(Object.entries(o).filter(([key]) => props.includes(key)));
let obj = {otherData:'other data',...from(user.profile, "firstName")};
```

which should be possible to code as

```
const user = {profile:{firstName:"00", lastName:"11"}};
 // preserve right-side/last value syntax to avoid confusion
let obj = {otherData:'other data',...{ from user.profile {firstName} }};
```

and, similar to
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Assigning_to_new_variable_names

```
const user = {profile:{firstName:"00", lastName:"11"}};
let obj = {otherData:'other data'};
({firstName /* , lastName, ...props */} from user.profile to obj);
```
guest271314 at gmail.com (2019-06-02T00:30:30.652Z)
```from``` implementation using JavaScript

```
const user = {profile:{firstName:"00", lastName:"11"}};
const from = (o, ...props) =>

Object.fromEntries(Object.entries(o).filter(([key]) =>

props.includes(key)));
let obj = {otherData:'other data',...from(user.profile, "firstName")};
```

which should be possible to code as

```
const user = {profile:{firstName:"00", lastName:"11"}};
 // preserve right-side/last value syntax to avoid confusion
let obj = {otherData:'other data',...{ from user.profile {firstName} }};
```

and, similar to
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Assigning_to_new_variable_names

```
const user = {profile:{firstName:"00", lastName:"11"}};
let obj = {otherData:'other data'};
({firstName /* , lastName, ...props */} from user.profile to obj);
```