blob: 47e6d35d1e420dd633f66082c40b99d82ff4e047 [file] [log] [blame]
"use strict";
var Iteration = require("./iteration");
module.exports = ArrayIterator;
function ArrayIterator(iterable, start, stop, step) {
this.array = iterable;
this.start = start || 0;
this.stop = stop || Infinity;
this.step = step || 1;
}
ArrayIterator.prototype.next = function () {
var iteration;
if (this.start < Math.min(this.array.length, this.stop)) {
iteration = new Iteration(this.array[this.start], false, this.start);
this.start += this.step;
} else {
iteration = new Iteration(undefined, true);
}
return iteration;
};