@beardedtim/fp-iterators
v0.1.2
Published
> This makes sense, right?
Downloads
16
Maintainers
Readme
FP Iterators
This makes sense, right?
Usage
import { map, take, from } from '@beardedtim/fp-iterators'
const iterator = from(1,2,3,4,5)
[...iterator] // [1,2,3,4,5]
const doubled = map(x => x * 2, iterator)
[...doubled] // [2,4,6,8,10]
const first3 = take(3,doubled)
[...first3] // [2,4,6]
Most methods are also curried, so we can also do:
const double = map(x => x * 2),
doubledIterator = double(iterator)
[...doubledIterator] // [2,4,6,8,10]
const take3 = take(3),
first3 = take3(doubledIterator)
[...first3] // [2,4,6]
Curried Methods
- all
- at
- concat
- drop
- dropUntil
- filter
- find
- includes
- iterate
- join
- map
- range
- reduce
- some
- take
- takeUntil
- zip
Tests
You can run yarn run test
for a single check, test:w
for re-testing, or coverage
to get a coverage report from Jest.
Contribution
Be sure to at least skim the Contributing file before making a PR or issue