New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Do not call callback for Map.prototype.forEach if no map entries exist #1300
Conversation
Does this work for case like x.set(42, 'hi')
x.set(43, 'bye')
x.delete(43) (edit: typo) ? My intuition is it would have the same problem, calling the callback extra time at the very end because of the deleted item. |
@gaearon That should work already but just in case I have added a test with your code. |
Apologies for dumb question but could you help me understand why it also works? Since the new check is for |
I think I understand now. If it's the last one, you decrement |
@gaearon There was still a bug in there, thanks for getting me to look at it even more thoroughly 👍 |
Fixes #1299