Array#flat is coming to ES; would you like like some sugar with that?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Array#flat is coming to ES; would you like like some sugar with that?

Michael Rosefield
Apologies 'if' this is a terrible idea, but since I have just encountered a situation where this sugar would actually be useful I'm absolutely going to suggest it.

Extend the ... syntax to allow for flattening deconstructed arrays. _Literally_ extend it:

....array === ...(array.flat()) // i.e. depth 1
.....array === ...(array.flat(0)) // unlimited depth




_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Array#flat is coming to ES; would you like like some sugar with that?

Isiah Meadows-2
Not stating my opinion of the idea here, but I find it unlikely that
it'll get accepted, for similar reasons to why the old proposed
comprehension syntax got omitted in favor of just using `map` and
`filter` (arrow functions are concise enough).
-----

Isiah Meadows
[hidden email]
www.isiahmeadows.com


On Thu, Jun 21, 2018 at 7:23 AM, Michael Luder-Rosefield
<[hidden email]> wrote:

> Apologies 'if' this is a terrible idea, but since I have just encountered a
> situation where this sugar would actually be useful I'm absolutely going to
> suggest it.
>
> Extend the ... syntax to allow for flattening deconstructed arrays.
> _Literally_ extend it:
>
> ....array === ...(array.flat()) // i.e. depth 1
> .....array === ...(array.flat(0)) // unlimited depth
>
>
>
>
> _______________________________________________
> es-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss