async-iterable-stream
Advanced tools
Comparing version 1.0.1 to 1.0.2
class AsyncIterableStream { | ||
constructor(generatorFactory) { | ||
this.generatorFactory = generatorFactory; | ||
constructor(asyncIteratorFactory) { | ||
this._asyncIteratorFactory = asyncIteratorFactory; | ||
} | ||
next() { | ||
return this.generatorFactory().next(); | ||
return this._asyncIteratorFactory().next(); | ||
} | ||
@@ -15,3 +15,3 @@ | ||
[Symbol.asyncIterator]() { | ||
return this.generatorFactory(); | ||
return this._asyncIteratorFactory(); | ||
} | ||
@@ -18,0 +18,0 @@ } |
{ | ||
"name": "async-iterable-stream", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A readable async stream which can be iterated over using a for-await-of loop.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "./node_modules/mocha/bin/_mocha --reporter spec --timeout 10000 --slow 10000" | ||
}, | ||
"repository": { | ||
@@ -7,0 +10,0 @@ "type": "git", |
# async-iterable-stream | ||
A readable stream which can be iterated over using a for-await-of loop. | ||
The constructor accepts an `asyncIteratorFactory` as argument; this can be either an async generator function or a regular function which returns an async iterator. | ||
In the case of a generator function, the `asyncIteratorFactory` should yield a sequence of `Promise` objects which resolve one at a time in the same order as they appear in the sequence. | ||
## Installation | ||
``` | ||
npm install async-iterable-stream | ||
``` |
5245
5
96
12