| 50 | readonly self: T |
| 51 | |
| 52 | constructor(self: T) { |
| 53 | this.self = self |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Yields the stored value once, then completes with the value sent back in. |
| 58 | * |
| 59 | * **When to use** |
| 60 | * |
| 61 | * Use to advance a `SingleShotGen` through its single yield and completion |
| 62 | * step. |
| 63 | * |
| 64 | * @since 2.0.0 |
| 65 | */ |
| 66 | next(a: A): IteratorResult<T, A> { |
| 67 | return this.called ? |
| 68 | ({ |
| 69 | value: a, |
| 70 | done: true |
| 71 | }) : |
| 72 | (this.called = true, |
| 73 | ({ |
| 74 | value: this.self, |
| 75 | done: false |
| 76 | })) |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Creates a fresh single-shot iterator over the stored value. |
| 81 | * |
| 82 | * **When to use** |
| 83 | * |
| 84 | * Use to iterate the wrapped value again without reusing the consumed |
| 85 | * iterator state. |
| 86 | * |
| 87 | * @since 2.0.0 |
| 88 | */ |
| 89 | [Symbol.iterator](): IterableIterator<T, A> { |
| 90 | return new SingleShotGen<T, A>(this.self) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Type-level marker encoding the variance of a `TypeLambda`'s type |
| 96 | * parameters. |
| 97 | * |
| 98 | * **When to use** |
| 99 | * |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…