asynciterable
v1.1.0
Published
Async iterable class
Downloads
15
Readme
asynciterable
Async iterable class
AsyncIterable is a class that implement the async iterable
JavaScript pattern,
using a semantic similar to the promise one.
Usage
Create an async iterable that emit three numbers:
import AsyncIterable from 'asynciterable';
const numbers = new AsyncIterable((write, end, error) => {
write(1);
write(2);
write(3);
end();
});
for await (const n of numbers) {
console.log(n)
}
// Output: 1\n2\n3\n
API
Install
With npm installed, run
npm install --save asynciterable
See Also
License
MIT