Crash after reusing enumerable
tzachshabtay opened this issue · 2 comments
A lot of functions pass undefined
as their _target
when creating a new EnumerableImpl
, and a lot of other functions are then using this _target
and will of course crash.
Here's a demo (in this specific demo, Where
creates an undefined
which then crashes Any
):
https://jsfiddle.net/rdw5uetf/
Is this only a problem with the Any
function? I see _target
being used in several other functions as well. I'm trying to understand how this library works, what's the purpose of _target
? Why is it being passed as undefined
when creating new enumerables?
It was only problem with Any().
_target holds reference to Iterable. In case where deferred method is used and no new iterable is provided (Where(...) for example ) _target is not used. Source of iterations is derived from _factory.