@agen/map
v0.1.0
Published
Transforms items to new ones
Downloads
2
Readme
@agen/map
Transform items from the parent async generator to new values.
This method accepts the following parameters:
- generator - asynchronous generator providing inidvidual items
- map - method transforming the initial item
It returns an asynchronous generator providing transformed items.
Example:
const batch = require('@agen/map');
...
const list = [ 'a', 'b', 'c' ]
for await (let item of map(list, (v, i) => v.toUpperCase()) {
console.log('-', item);
}
// Will print
// - A
// - B
// - C