0.1.0 • Published 5 years ago

@agen/map v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

@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