1.0.0 • Published 6 years ago

@basic-streams/ap v1.0.0

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

@basic-streams/ap

ap<T, U>(streamf: Stream<(x: T) => U>, streamv: Stream<T>): Stream<U>

Creates a stream that will contain values created by applying the latest function from streamf to the latest value from streamv every time one of them updates.

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

const streamf = ofMany([x => x + 2, x => x - 2], 10000)
const streamv = ofMany([1, 2, 3], 8000)

const result = ap(streamf, streamv)

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

// > 3
// > 4
// > 0
// > 1

//               x => x + 2   x => x - 2
// streamf: _________._________.
// streamv: _______1_______2_______3
// result:  _________3_____4___0___1
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.2

6 years ago

0.0.1

6 years ago