proposal of function return with object destructor

Isiah Meadows isiahmeadows at gmail.com
Tue Oct 10 12:05:49 UTC 2017


You did start in the right spot! Search esdiscuss.com for "pick notation",
though - it's pretty much the same thing, but an expression instead.

(TL;DR: it was rejected as overly specific, since it's maybe saving a
couple lines of code, and it's also pretty easy to write a utility function
if you find yourself doing this a lot. Also, Lodash and similar do have
utility methods for this kind of thing.)

On Tue, Oct 10, 2017, 07:15 Новиков Денис <den-vse at yandex.ru> wrote:

> Hi! Sorry, I don't sure that it is a place for feature request - pls,
> write if I wrong.
> My proposal is to allow return of part of object fields.
>
> Yesterday I wrote some ugly code:
>
> const { id, displayName, type, isEnabled } = segment;
>   return { id, displayName, type, isEnabled };
>
>
> There is problem with duplication. I think next variant looks much better:
>
>
> return { id, displayName, type, isEnabled } = segment;
>
>
>
> Thank you and sorry if this email is incorrect for proposals.
> _______________________________________________
> 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/20171010/c3e8a653/attachment.html>


More information about the es-discuss mailing list