proposal-iterator-helpers
proposal-iterator-helpers copied to clipboard
taking Infinity or dropping 0
Should iter.take(Infinity)
or iter.drop(0)
return iter
instead of wrapping it unnecessarily?
I would lean towards wrapping, for consistency. It's weird for the identity to depend on the precise value of an argument like this, and I can imagine code along the lines of
let next = Iterator.HelperPrototype.next;
[...]
let skipped = base.drop(n);
[...]
next.call(skipped);
which would break if it happened to hit one of the special cases.
Not totally convinced on this one, but I will admit it's unusual. Closing.