Description
I hope to start a discussion about 11.1.
I bet you know trine. The whole concept of the lib is based on iterators – to have a unified set of functions working with any sort of collection. It looks very elegant and “native” to JS:
const characters = strings
::map(String.prototype.split::partial(""))
::reduce(Array.prototype.concat)
.sort()
::uniq();
👍 Using iterators this way doesn’t involve managing state, except when writing the utilies.
👍 There’s no risk of mutating stuff. Every function is returns a new iterator.
👍 One more bonus – the thing is lazy. So you can map over infinite collections, etc. Lots of functional programming goodness.
👎 There’s one “but”. Working with iterators in such an elegant way is only possible with the function bind syntax. And that doesn’t come into the spec until ES 2016 (if at all). They do transpile cleanly to ES5 with babel though.