Set iterators

Domenic Denicola domenic at domenicdenicola.com
Mon Feb 13 07:55:22 PST 2012


> As a starting point, would it make sense to provide an API that matches Array.prototype methods (where applicable)?

I think this ties in to my earlier desire to make Array.prototype methods work with iterators in general [1]. That is, I think the correct way to do this would be:

1) To specify that "set is an iterator that, when iterated over, returns its values."
2) To specify that all iterators get (at least): every, filter, forEach, map, reduce, reduceRight, some

One potential sticking point is that we might want filter and map to return sets themselves.

[1]: https://mail.mozilla.org/pipermail/es-discuss/2012-February/020356.html



More information about the es-discuss mailing list