| 2772 | this.slideIndex = this.buffer.index |
| 2773 | } |
| 2774 | take(): A | undefined { |
| 2775 | if (this.remaining === 0) { |
| 2776 | return undefined |
| 2777 | } |
| 2778 | this.sync() |
| 2779 | const value = this.values[this.index] |
| 2780 | this.values[this.index] = AbsentValue as unknown as A |
| 2781 | this.index = (this.index + 1) % this.values.length |
| 2782 | this.remaining-- |
| 2783 | if (this.remaining === 0) { |
| 2784 | this.close() |
| 2785 | } |
| 2786 | return value as A |
| 2787 | } |
| 2788 | takeN(n: number): Array<A> { |
| 2789 | const len = Math.min(n, this.remaining) |
| 2790 | const items = new Array(len) |