json-api-schema
Version:
JSON Api Schema is a JSON dialect that can describe any Web Based API that uses JSON to exchange data.
38 lines (29 loc) • 704 B
JavaScript
var ArrayIterator;
ArrayIterator = (function() {
function ArrayIterator(data) {
this.data = data;
this.index = 0;
this.length = this.data.length;
}
ArrayIterator.prototype.next = function() {
var element;
if (!this.hasNext()) {
return null;
}
element = this.current();
this.index += 1;
return element;
};
ArrayIterator.prototype.hasNext = function() {
return this.index < this.length;
};
ArrayIterator.prototype.rewind = function() {
this.index = 0;
return this.current();
};
ArrayIterator.prototype.current = function() {
return this.data[this.index];
};
return ArrayIterator;
})();
module.exports = ArrayIterator;