Map: filter/map and more

Tab Atkins Jr. jackalmage at gmail.com
Thu Nov 20 10:14:30 PST 2014


On Wed, Nov 19, 2014 at 4:49 PM, Dmitry Soshnikov
<dmitry.soshnikov at gmail.com> wrote:
> (For the history of this thread to refer to it later)
>
> At the meeting it was decided not to go with `map` and `filter` sitting on
> `Map.prototype`, but instead to use iterators in the way like:
>
> ```
> map
>   .entries() // returns an iterator
>   .map((v, k, m) => { ... })
>   .filter((v, k, m) => { ... })
>   .collect(); // returns a new map after all transforms
> ```

Sounds good!  (I always end up calling one of the iterators on python
dicts anyway, since I can never remember what the default iterator
behavior is.)

I presume that .collect() expects an iterator of [k,v] pairs or
something?  Also: this is the first I've heard of .collect().  I
presume that'll show up in the spec?

~TJ


More information about the es-discuss mailing list