Proposal: named and bound deconstructions

Darien Valentine valentinium at
Thu Jan 25 08:31:47 UTC 2018

> There might also be occasions when we want to do something like this:
>    const { bar } = foo,
>          { baz, blah } = bar;
> Here, we might find it useful to get deconstructed references to both bar
and its properties baz and blah, but we have to do it in two steps.

Unless I’m misunderstanding what you mean, doing this in a single pattern
is already accounted for:

    const { bar, bar: { baz, blah } } = foo;

There’s no restriction on the number of times the key appears.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list