map-gen
Map for generator.
Installation
$ npm install @f/map-gen
Usage
var map = require('@f/map-gen')
Array.from(map(addOne, function * () {
yield 1
yield 2
yield 3
})) // [2, 3, 4]
function addOne(v) {
return v + 1
}
API
mapGen(fn, gen)
-
fn
- mapping function -
gen
- generates values to map
Returns: generator of mapped values
License
MIT