Defense for eached array alteration, fixes #557 #558
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Altering the array of iterables after calling each on the array makes async either call the callback several times or not call the callback at all (depending on wether you add or remove array items).
Although it is probably not a very good practise to alter the array while it is being iterated with each, sometimes the array is passed on and the person receiving the array does not know that such requirement is in place.
The current async behaviour in such situations is very problematic and this commit should fix the problems. This should fix #557 .