-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Hey there!
I noticed that iterators produced by the toIter
and iterator
methods don't have a Symbol.iterator
/@@iterator
method on them and thus won't work with for..in
, yield*
, new Set()
, etc. This is mentioned in the comments as part of iterator protocol, so before I submit a PR I was wondering: is that an intentional omission?
It'd be nice to have in ES6, so the resultant iterators can be used with things like
function* flatten(iterable) {
for (let item of iterable) {
if (item[Symbol.iterator]) yield* flatten(item);
yield item;
}
}
binki
Metadata
Metadata
Assignees
Labels
No labels