fix async iterator
This commit is contained in:
		
							parent
							
								
									1e53d7d770
								
							
						
					
					
						commit
						5e65673107
					
				
					 3 changed files with 7 additions and 3 deletions
				
			
		|  | @ -63,7 +63,9 @@ export class BaseManager<T, T2> { | |||
|   async *[Symbol.asyncIterator](): AsyncIterableIterator<T2> { | ||||
|     const arr = (await this.array()) ?? [] | ||||
|     const { readable, writable } = new TransformStream() | ||||
|     arr.forEach((el) => writable.getWriter().write(el)) | ||||
|     const writer = writable.getWriter() | ||||
|     arr.forEach((el: unknown) => writer.write(el)) | ||||
|     writer.close() | ||||
|     yield* readable | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
|  | @ -43,7 +43,9 @@ export class BaseChildManager<T, T2> { | |||
|   async *[Symbol.asyncIterator](): AsyncIterableIterator<T2> { | ||||
|     const arr = (await this.array()) ?? [] | ||||
|     const { readable, writable } = new TransformStream() | ||||
|     arr.forEach((el: unknown) => writable.getWriter().write(el)) | ||||
|     const writer = writable.getWriter() | ||||
|     arr.forEach((el: unknown) => writer.write(el)) | ||||
|     writer.close() | ||||
|     yield* readable | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue