MCPcopy Create free account
hub / github.com/fbeline/design-patterns-JS / Iterator

Class Iterator

src/behavioral/iterator/iterator_es6.js:1–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class Iterator {
2
3 constructor(el) {
4 this.index = 0;
5 this.elements = el;
6 }
7
8 next() {
9 return this.elements[this.index++];
10 }
11
12 hasNext() {
13 return this.index < this.elements.length;
14 }
15}
16
17export default Iterator;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected