jalhyd
Version:
JaLHyd, a Javascript Library for Hydraulics
40 lines • 1.07 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NumberArrayIterator = void 0;
/**
* itérateur sur les valeurs prises par un tableau
*/
class NumberArrayIterator {
constructor(_arr) {
this._arr = _arr;
this._it = this._arr[Symbol.iterator](); // crée un itérateur à partir d'un tableau
this._index = 0;
}
count() {
return this._arr.length;
}
get hasNext() {
return this._index < this._arr.length;
}
next() {
this._index++;
const res = this._it.next();
if (!res.done) {
this._current = res.value;
}
return res;
}
/** trick method - use .next() instead, unless you are explicitely in jalhyd#222 case */
nextValue() {
return this.next();
}
get currentValue() {
return this._current;
}
// interface IterableIterator
[Symbol.iterator]() {
return this;
}
}
exports.NumberArrayIterator = NumberArrayIterator;
//# sourceMappingURL=number_array_iterator.js.map