Axel Rauschmayer (2014-10-01T20:17:12.000Z)
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]));
> ```

Almost. Correct versions:

```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]));
```

-- 
Dr. Axel Rauschmayer
axel at rauschma.de
rauschma.de



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141001/ea71b258/attachment.html>
forbes at lindesay.co.uk (2016-02-01T12:29:45.348Z)
Almost. Correct versions:

```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]));
```