I'm using the Object destructuring syntax of ES6. I want to use it in order to populate an existing object.
I got two objects:
let $scope = {};
let email = { from: 'cyril@so.com', to: 'you@so.com', ... };
I want to assign some email
object properties to the $scope
object.
For now, I've end up doing so:
({ from: $scope.from, to: $scope.to } = email);
In my real life use case I have more than two properties to be assigned.
So, do you know an other way to improve and avoid repeating the $scope
in the left assignation part?