xstream-switch-last
v1.0.0
Published
Transform a stream of stream to a stream by always taking value from the lastest one.
Downloads
4
Readme
xstream-switch-last
Transform a stream of stream to a stream by always taking value from the lastest one.
Marble diagram:
--+--------+---------------
\ \
\ ----1----2---3--
--a--b----c----d--------
flattenConcurrently
-----a--b------1----2---3--
const stream = xs.merge(
xs.of(xs.periodic(100)),
xs.of(1).compose(delay(350)).mapTo(xs.periodic(100).take(3).map(i => i + 10)),
)
.compose(switchLast);
// [0,1,2,10,11,12]