Don't you just mean the following:
```
const {abc, xyz, qnc: {awj}} = obj;
```
On Wed, Oct 25, 2017 at 12:22 AM, Sebastian Malton <[email protected]>
wrote:
> This could also be extended to help with cleansing objects.
>
> const abc = {cde, def, efg} = obj;
>
> Would create an object abc with only those three fields in it.
>
> *From:* [email protected]
> *Sent:* October 24, 2017 2:51 PM
> *To:* [email protected]
> *Subject:* Extend Object Dereferencing
>
> 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. If qnc is not present then an undefined dereference exception
> would be thrown.
>
> This could also be extended with the proposed '?.' notation to go even
> deeper safely.
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss