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