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

Felipe Nascimento de Moura felipenmoura at gmail.com
Fri Mar 17 01:39:13 UTC 2017


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!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170316/9c98e47c/attachment.html>


More information about the es-discuss mailing list