Map: filter/map and more
Axel Rauschmayer
axel at rauschma.de
Thu Nov 20 10:51:38 PST 2014
> On 20 Nov 2014, at 1:49 , 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
> ```
Question – shouldn’t this example be written as follows?
```
map
.entries() // returns an iterator
.map(([k,v], i, m) => { ... })
.filter(([k,v], i, m) => { ... })
.collect(); // returns a new map after all transforms
```
Otherwise, I suggest to change the names (e.g. to `mapPairs` and `filterPairs`).
--
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/20141120/393603ab/attachment-0001.html>
More information about the es-discuss
mailing list