Package io.karatelabs.js
Interface JsIterator
Spec-style values iterator returned by
IterUtils.getIterator(java.lang.Object, io.karatelabs.js.Context).
Used by for-of, spread, destructuring, and Array.from — the call sites
that require ECMAScript GetIterator semantics (TypeError on non-iterable,
value-only enumeration, no key channel).-
Method Summary
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Method Details
-
close
IteratorClose (spec 7.4.6): invoke the iterator'sreturnmethod when iteration ends before the iterator is exhausted (destructuring with no rest element, for-ofbreak/return/throw). The internal array / string iterators have no observablereturn, so the default is a no-op; only user-defined iterators (objects withSymbol.iterator) override it.dueToErrormirrors the spec's completion argument: whentruethe surrounding completion is already abrupt, soreturn's own result and any error it raises are discarded (the original completion wins). Whenfalseareturnthat throws propagates, and a non-objectreturnresult is a TypeError.
-