Map: filter/map and more
Andy Wingo
wingo at igalia.com
Fri Nov 28 03:51:34 PST 2014
On Thu 20 Nov 2014 01:49, Dmitry Soshnikov <dmitry.soshnikov at gmail.com> writes:
> 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
> ```
Is there a nice way to do this for the default iterator? This is pretty
terrible:
[1,2,3][Symbol.iterator]().map(x=>x+1)
Also, I thought that map, filter, and such were to be on the
Iterator.prototype. That precludes multi-arg map functions, doesn't it?
Andy
More information about the es-discuss
mailing list