Rick Waldron (2014-10-01T20:27:28.000Z)
On Wed, Oct 1, 2014 at 4:17 PM, Axel Rauschmayer <axel at rauschma.de> wrote:

> On Oct 1, 2014, at 22:12 , Axel Rauschmayer <axel at rauschma.de> wrote:
>
> 1. Transforming iteration methods
>
> We're currently polyfillying the `Map`, and got some questions form devs.
> One of them is about transforming iteration methods, like `map` and
> `filter`.
>
> Unfortunately I missed that part of the spec when it was approved, so can
> someone please remind/clarify -- was it an intended decision not to hap
> Map#map, Map#filter? I can see only Map#forEach in the spec. Are maps
> "immutable"? -- That's fine, the `map` and `filter` return a new map.
>
>
> FWIW: I’ll probably use the following work-arounds. I don’t expect
> performance to be an issue for my applications; it’d be interesting to hear
> if it becomes a problem for someone.
>
> ```js
> let map2 = new Map(map1.entries().filter((key, value) => key >= 0));
> let map2 = new Map(map1.entries().map((key, value) => [key * 2, value *
> 2]));
>
> entries() returns an iterator, not an array.

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141001/933522da/attachment.html>
forbes at lindesay.co.uk (2016-02-01T12:33:30.547Z)
> ```js
> let map2 = new Map(map1.entries().filter((key, value) => key >= 0));
> let map2 = new Map(map1.entries().map((key, value) => [key * 2, value *
> 2]));

`entries()` returns an iterator, not an array.