Skip to content

Instantly share code, notes, and snippets.

@nolawnchairs
Created September 15, 2019 12:18
Show Gist options
  • Save nolawnchairs/d89768223176ace6b748aa3baf9d49cc to your computer and use it in GitHub Desktop.
Save nolawnchairs/d89768223176ace6b748aa3baf9d49cc to your computer and use it in GitHub Desktop.
Unfinished Modular iterator
export class ModularItem<E> {
private readonly _value: E
private _position = 0
constructor(value: E, position: number = 0) {
this._value = value
this._position = position
}
advance() {
this._position++
}
retreat() {
this._position--
}
reset() {
this._position = 0
}
get value(): E {
return this._value
}
get position(): number {
return this._position
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment