Skip to content

Latest commit

 

History

History

lift

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

flyd-lift

Merge the latest values from multiple streams into a single stream using a function.

Emits a new value every time any source stream has a new value.

Graph

a:               {---1----2----}
b:               {-----1----2--}
lift(add, a, b): {-----2--3-4--}

Signature

( ((a, b, ...) -> c), (Stream a, Stream b, ...) ) -> Stream c

Usage

const lift = require('flyd/module/lift')

const n1 = flyd.stream(1)
const n2 = flyd.stream(4)
const n3 = flyd.stream(9)

const addThree = (a, b, c) => a + b + c
const sum = lift(addThree, n1, n2, n3)

sum() // 14

n2(5)
sum() // 15