You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idiomatic way of iterating through all entries of an (async) iterator in JS is to use the for const of syntax:
// For regular iteratorsfor(constitemofiterator){console.log(item)}// For async iteratorsforawait(constitemofiterator){console.log(item)}
However, this isn't possible in ReScript because we have no for const of syntax. So, I propose we add 2 helpers that accomplishes the same thing as for const of does, namely iterating through all items from the iterator.
I think this fits in Core because we'll never have the for const of syntax in ReScript, and this would help make it easy for beginners to use iterators whenever they encounter them.
The text was updated successfully, but these errors were encountered:
The idiomatic way of iterating through all entries of an (async) iterator in JS is to use the
for const of
syntax:However, this isn't possible in ReScript because we have no
for const of
syntax. So, I propose we add 2 helpers that accomplishes the same thing asfor const of
does, namely iterating through all items from the iterator.They'd look like this:
The implementation would be via a
while
loop:I think this fits in
Core
because we'll never have thefor const of
syntax in ReScript, and this would help make it easy for beginners to use iterators whenever they encounter them.The text was updated successfully, but these errors were encountered: