@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
31 lines (20 loc) • 601 B
JavaScript
import { AbstractArrayIterator } from "./AbstractArrayIterator.js";
export class ArrayIteratorSequential extends AbstractArrayIterator {
__i = 0;
initialize(data) {
super.initialize(data);
this.__i = 0;
}
next(result) {
const data = this.__data;
const length = data.length;
if (this.__i >= length) {
result.value = undefined;
result.done = true;
} else {
result.value = data[this.__i];
result.done = false;
this.__i++;
}
}
}