How to use the @most/core.switchLatest function in @most/core

To help you get started, we’ve selected a few @most/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github motorcyclejs / motorcyclejs / stream / src / combinators / switchCombine.ts View on Github external
export function switchCombine<a>(
  streams$: Stream&gt;&gt;): Stream&gt;
{
  return switchLatest(
    map(
      (streams) =&gt; streams.length === 0 ?
        just([]) :
        combineArray(Array, streams as Array&gt;),
      streams$,
    ),
  )
}
</a>
github motorcyclejs / motorcyclejs / stream / src / combinators / switchMerge.ts View on Github external
export function switchMerge<a>(
  streams$: Stream&gt;&gt;): Stream&gt;
{
  return switchLatest&gt;(
    map(
      (streams) =&gt; streams.length === 0 ? just([]) : mergeArray(streams),
      streams$,
    ),
  )
}
</a>