Module Js.IteratorSource

JavaScript Iterator API

Sourcetype 'a t
Sourcetype 'a value = {
  1. done_ : bool option;
  2. value : 'a option;
}
Sourceval make : 'a Seq.t -> 'a t

make seq creates an iterator from a sequence. Native-only addition: melange has no constructor since iterators come from JavaScript itself.

Sourceval next : 'a t -> 'a value

next it advances the iterator. Once exhausted, it keeps returning { done_ = Some true; value = None }, matching JavaScript semantics.

Sourceval toArray : 'a t -> 'a array
Sourceval toArrayWithMapper : 'a t -> f:('a -> 'b) -> 'b array