Skip to content

juliangruber/co-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

co-map

Map a co generator stream over a function.

build status

Usage

var read = map(stream(), function*(data, i){
  return i + ': ' + data;
});

var data;
while (data = yield read()) console.log(data);

API

map(read, fn)

Call fn with each value read yields, plus its iteration index, and yield the return value.

A falsy return yields skips a value and doesn't end the stream.

read can also be an Array.

Installation

$ npm install co-map

License

MIT

About

Map a co generator stream over a function

Resources

Stars

Watchers

Forks

Packages

No packages published