Skip to content

Conversation

@babs20
Copy link
Contributor

@babs20 babs20 commented Jul 22, 2024

Codemod for iterate-iterator

Copy link

@zloirock zloirock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iterators are not always iterable, so for proper work in for-of and Array.from they should be wrapped to { [Symbol.iterator](){ return iterator } }.

@babs20
Copy link
Contributor Author

babs20 commented Jul 22, 2024

@zloirock I think that case it not intended to be handled by the package this codemod replaces. That seems like a case we would cover when we create the codemod for the iterate-value package

@zloirock
Copy link

Try something like this:
Снимок экрана 2024-07-22 в 09 57 20

refactor: use [Symbol.iterator]
@babs20 babs20 force-pushed the feature/iterate-iterator branch from 55e51b2 to 37a9feb Compare July 22, 2024 03:37
@babs20
Copy link
Contributor Author

babs20 commented Jul 22, 2024

@zloirock Thank you for pointing that out! Added logic to use [Symbol.iterator] and an additional test case based on your comment.

@babs20
Copy link
Contributor Author

babs20 commented Aug 27, 2024

Anything I can update to help complete this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants