Skip to content

Conversation

@kasbah
Copy link
Contributor

@kasbah kasbah commented Oct 13, 2024

closes #249

This should probably be fixed in Clojurescript itself but I'm out of my depth here already (I am a Clojure noob).

We can't do (es6-iterable ES6Iterator) because that would be infinite recursion so we patch the ES6Iterator prototype with the Symbol.iterator directly, sans recursion.

Interestingly enough cljs.core/keys already returns a KeySeq which has Symbol.iterator but no next function. Applying es6-iterator, as we do, seems give it the next function but strip Symbol.iterator.

This doesn't yet fix [...e] because I'm not quite sure what the intention there is, I guess the same as [...e.entries()]?

@tonsky tonsky merged commit 7ef5a69 into tonsky:master Oct 14, 2024
@tonsky
Copy link
Owner

tonsky commented Oct 14, 2024

Awesome! Thank you!

tonsky added a commit that referenced this pull request Oct 14, 2024
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.

JS Iterator protocol for entries

2 participants