xstream-switch-last

1.0.0 • Public • Published

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]
 

Readme

Keywords

Package Sidebar

Install

npm i xstream-switch-last

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

11.6 kB

Total Files

7

Last publish

Collaborators

  • b123400