Extend Object Dereferencing

T.J. Crowder tj.crowder at farsightsoftware.com
Wed Oct 25 12:22:35 UTC 2017


On Wed, Oct 25, 2017 at 1:15 PM, Sebastian Malton
<sebastian at malton.name> wrote:
>
> I didn't mean that part when I said multiple levels. I meant
> the following
> ```
> const abc = { { bcd, cde, efg: {qnc} } = obj};
>
> ```

I was responding to your initial assertion in your first message, which
didn't show that form. It just said

> Currently you can do the following
>
> `const {abc, xyz, qnc} = obj;`
>
> However if you want to go more than one level deep then you have to do it
again for each level.
>
> ...
>
> I therefore propose the ability to do the following
>
> `const {abc, xyz, qnc.awj} = obj;`
>
> And this would create the variables 'abc'', 'xyz', 'awj' with the
> values from obj.

I was pointing out how you can do that without having to "do it again."

Perhaps you could clarify what you're actually proposing. Your first
message talked about individual variables for the parts of `obj`;
subsequently you seemed to be talking about creating a new object
(combining object initializers with destructuring)...?

-- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171025/e88c558d/attachment.html>


More information about the es-discuss mailing list