callbag-from-async-iter

1.0.0 • Public • Published

callbag-from-async-iter

👜 Converts an async iterable or iterator into a callbag pullable source

npm install callbag-from-async-iter

Example

Async range from a generator function

const fromAsyncIter = require('callbag-from-async-iter');
const { forEach, pipe } = require('callbag-basics');
 
async function * asyncRange() {
  let n = 0;
  while (< 10000) {
    yield Promise.resolve(n++);
  }
}
 
pipe(
  fromAsyncIter(asyncRange()),
  forEach((x) => {
    console.log(x); // 0, 1, ..., 9999
  })
);

Readme

Keywords

Package Sidebar

Install

npm i callbag-from-async-iter

Weekly Downloads

62

Version

1.0.0

License

MIT

Unpacked Size

7.46 kB

Total Files

5

Last publish

Collaborators

  • francisco.tln