1.0.1 • Published 9 years ago
@iterables/map v1.0.1
@iterables/map
A map generator for iterators.
const map = require('@iterables/map')
const iter = map(function * () {
yield 1
yield 2
}(), xs => xs * 2)
console.log([...iter]) // [2, 4]Installation
$ npm install --save @iterables/mapAPI
map(iterable, fn) -> Iterator
iterable: anyIterator— a generator instance,Array,Map,String, orSetfn: A function takingxs,idx, andalland returning any value.xs: an item fromiterable.idx: a number reflecting the index of the current item.all: the fulliterableobject.
Returns a mapped iterator. Pretty standard stuff!
License
MIT
1.0.1
9 years ago