On Wed, Oct 1, 2014 at 4:17 PM, Axel Rauschmayer <a...@rauschma.de> wrote:

> On Oct 1, 2014, at 22:12 , Axel Rauschmayer <a...@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
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to