Skip to content
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

[Bug] counter/index argument is not provided to callback functions #22

Closed
julienroyer opened this issue Apr 11, 2024 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@julienroyer
Copy link

Describe the bug

For sync map/filter at least, only one argument is provided to the callback function (the current element).

The iterator helpers proposal specifies that the callback functions are provided two arguments: the current element and its counter/index.

To Reproduce

[...Iterator.from([0, 1]).filter((x, idx) => idx)]

Expected behavior

expected [1], got []

@julienroyer julienroyer added the bug Something isn't working label Apr 11, 2024
@julienroyer julienroyer changed the title [Bug] [Bug] counter/index argument is not provided to callback functions Apr 12, 2024
MadProbe added a commit that referenced this issue Apr 14, 2024
Improves typing & spec compliance
fixes: [Bug] Typing issue causes AsyncIterator.from(...) to fail against plain ES iterator-like things #21
fixes: [Bug] counter/index argument is not provided to callback functions #22
@MadProbe
Copy link
Owner

This has been fixed in version 3.0.0, and thank you for reporting this bug!
I still have in backlog making this polyfill more spec-compliant, and I have to carve out some time and will to make it as good as it can be.

@julienroyer
Copy link
Author

Thanks a lot for fixing this bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants