logoots-structs
Version:
Provides several data structures to represent a text using a ropes-like structure and manipulating it
18 lines (14 loc) • 334 B
JavaScript
var InfiniteString = function(ch, it) {
this.ch = ch || null;
this.it = it || null;
};
InfiniteString.prototype.hasNext = function () {
return true;
};
InfiniteString.prototype.next = function () {
if(this.it != null && this.it.hasNext())
return this.it.next();
else
return this.ch;
};
module.exports = InfiniteString;