@async-generator/map

1.0.2 • Public • Published

take outputs from one generator and transform them

It's like Array#map but for AsyncGenerator

installation

> npm i @async-generator/map

usage

const map = require("@async-generator/map");
const interval = require("@async-generator/interval");

const input = interval(100);
const output = map(input, x => x * x);

const actual = [];

for await (const item of output) {
  console.log(item); // will log 0, 1, 4, 9, 16, 25, ...
}

Package Sidebar

Install

npm i @async-generator/map

Weekly Downloads

6

Version

1.0.2

License

MIT

Unpacked Size

2.1 kB

Total Files

5

Last publish

Collaborators

  • tungv