json-api-schema
Version:
JSON Api Schema is a JSON dialect that can describe any Web Based API that uses JSON to exchange data.
47 lines (37 loc) • 1.06 kB
JavaScript
var IteratorsIterator;
IteratorsIterator = (function() {
function IteratorsIterator(iterators) {
this.iterators = iterators;
this.index = 0;
this.length = this.iterators.length;
}
IteratorsIterator.prototype.next = function() {
var ite;
ite = this._currentIterator();
return ite && ite.hasNext() && ite.next();
};
IteratorsIterator.prototype.hasNext = function() {
var ite;
ite = this._currentIterator();
return ite && ite.hasNext();
};
IteratorsIterator.prototype.rewind = function() {
this.index = 0;
return this.current();
};
IteratorsIterator.prototype.current = function() {
return this._currentIterator().current();
};
IteratorsIterator.prototype._currentIterator = function() {
if (this.index < this.length) {
if (this.iterators[this.index].hasNext()) {
return this.iterators[this.index];
} else {
this.index++;
return this._currentIterator();
}
}
};
return IteratorsIterator;
})();
module.exports = IteratorsIterator;