1.0.2 • Published 4 years ago

@async-generator/map v1.0.2

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

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, ...
}