HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/dev/shahnamag/back-end/node_modules/iterare/lib/slice.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class SliceIterator {
    /**
     * @param {Iterator<T>} source Source Iterator
     * @param {number} start Zero-based positive start index, inclusive
     * @param {number} end Zero-based positive end index, exclusive, defaults to end of iterator
     */
    constructor(source, start, end = Infinity) {
        this.source = source;
        this.start = start;
        this.end = end;
        this.i = 0;
    }
    next() {
        // Skip elements before start
        while (this.i < this.start) {
            const result = this.source.next();
            if (result.done) {
                return result;
            }
            this.i++;
        }
        // Finish when end is reached
        this.i++;
        if (this.i >= this.end) {
            return { done: true };
        }
        return this.source.next();
    }
}
exports.SliceIterator = SliceIterator;
//# sourceMappingURL=slice.js.map