Open
Description
Thoughts on making the Underscore wrapper an iterator and iterable?
It would require detecting Symbol.iterator
and doing something like
_.prototype[Symbol.iterator] = function() {
return this;
};
_.prototype.next = function() {
if (this.__values__ === undefined) {
this.__values__ = _.toArray(this.value());
}
var done = this.__index__ >= this.__values__.length,
value = done ? undefined : this.__values__[this.__index__++];
return { 'done': done, 'value': value };
};
Related to jashkenas/backbone#3954 (comment).