1.1.0 • Published 6 years ago

asynciterable v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

asynciterable

Travis Build Status NPM downloads

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