1.0.0 • Published 6 years ago

@basic-streams/chain v1.0.0

Weekly downloads
11
License
MIT
Repository
github
Last release
6 years ago

@basic-streams/chain

chain<T, U>(fn: (x: T) => Stream<U>, stream: Stream<T>): Stream<U>

Creates a stream containing all values from all streams created by applying the given function fn to each value in the given stream.

import ofMany from "@basic-streams/of-many"
import chain from "@basic-streams/chain"

const stream = ofMany([1, 2], 10000)
const fn = x => ofMany([x, x, x], 7000)

const result = chain(fn, stream)

result(x => {
  console.log(x)
})

// > 1
// > 1
// > 2
// > 1
// > 2
// > 2

// stream: _________1_________2
// fn(1):            ______1______1______1
// fn(2):                      ______2______2______2
// result: ________________1______1__2___1__2______2
1.0.0

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.1

6 years ago