-
Notifications
You must be signed in to change notification settings - Fork 469
Add Iterator.prototype bindings #7506
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Conversation
rescript
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/darwin-x64
@rescript/win32-x64
commit: |
external toArrayWithMapper: (t<'a>, 'a => 'b) => array<'b> = "Array.from" | ||
|
||
let forEach = (iterator, f) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm for this change 👍
Iterator.forEach
's behaviour was different to Iterator.prototype.forEach
as the latter only calls its callback with yielded values, not the iterator's final return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff, thanks a lot!
But could you use tests (using assertEqual
) instead of doing Console.log
s in the doc strings?
Yep, will do! I'm less familiar with that part of the codebase. |
Co-authored-by: Christoph Knittel <christoph@knittel.cc>
This one seems to fail on Linux: rescript/tests/tests/src/js_re_test.res Lines 5 to 19 in 97a81e5
No clue why, or how it could be related to my changes. |
This may be a bit controversial, but I've added bindings for Iterators and Generators and corrected some bindings, resulting in a minor breaking change.