Map: filter/map and more

Dmitry Soshnikov dmitry.soshnikov at gmail.com
Wed Nov 19 16:49:41 PST 2014


(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
```

The `forEach` method is the only which will still exist on `Map.prototype`,
and the committee agreed it's fine.

At the same time, the `forEach` can be called on iterator as well:

```
  map
    .entries()
    .map(...)
    .forEach(...);
```

Dmitry

On Mon, Nov 17, 2014 at 1:09 PM, Brendan Eich <brendan at mozilla.org> wrote:

> Dmitry Soshnikov wrote:
>
>> Is this something what is ready for discussion on a meeting (in
>> particular, tomorrow's meeting)?
>>
>
> You put something on the agenda, cool.
>
> https://github.com/tc39/agendas/blob/master/2014/11.md
>
> /be
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141119/49228fe2/attachment.html>


More information about the es-discuss mailing list