Question ... perhaps a proposal: extract from object to object

Bob Myers rtm at gol.com
Fri Mar 17 02:33:44 UTC 2017


This has been discussed ad nauseum, in this thread
<https://esdiscuss.org/topic/extended-dot-notation-pick-notation-proposal> and
elsewhere.
Some people call this "picking", or "deconstructing into objects".
There seems to be little appetite for taking it up, in spite of it being
(IMHO) a very common use case.

Bob

On Fri, Mar 17, 2017 at 7:09 AM, Felipe Nascimento de Moura <
felipenmoura at gmail.com> wrote:

> Hi.
> I am trying to get an object out of another object, with only a few of its
> properties.
>
> I know we can do this:
>
> let { a, c } = { a: 1, b: 2, c: 3 }
>
> In this case, we have a variable 'a' and a variable 'c'.
> What I want is { a: 1, c: 3}
>
> Is there a way to do it? Something like:
>
> let { a, c } as X = { a: 1, b: 2, c: 3 }
>
> and then, have the variable X with an object { a: 1, c: 3}
>
> Is there a way to do that? If now...would it make sense to become a
> proposal?
>
> Thanks.
>
> [ ]s
>
> *--*
>
> *Felipe N. Moura*
> Web Developer, Google Developer Expert
> <https://developers.google.com/experts/people/felipe-moura>, Founder of
> BrazilJS <https://braziljs.org/> and Nasc <http://nasc.io/>.
>
> Website:  http://felipenmoura.com / http://nasc.io/
> Twitter:    @felipenmoura <http://twitter.com/felipenmoura>
> Facebook: http://fb.com/felipenmoura
> LinkedIn: http://goo.gl/qGmq
> ---------------------------------
> *Changing  the  world*  is the least I expect from  myself!
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170317/13972e85/attachment.html>


More information about the es-discuss mailing list