guest271314 (2019-06-02T00:27:52.000Z)
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); ```