@agen/map

0.1.0 • Public • Published

@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

Readme

Keywords

none

Package Sidebar

Install

npm i @agen/map

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

1.99 kB

Total Files

5

Last publish

Collaborators

  • mkotelnikov