callbag-flatten
Callbag operator that flattens a higher-order callbag source. Like RxJS "switch" or xstream "flatten". Use it with map
to get behavior equivalent to "switchMap". Works on either pullable or listenable sources.
npm install callbag-flatten
examples
listenables
On each mouse click, start a stopwatch ticking every second:
const fromEvent = ;const interval = ;const flatten = ;const observe = ;const pipe = ;const map = ; const source = ;
pullables
Loop over two iterables (such as arrays) and combine their values together:
const fromIter = ;const iterate = ;const flatten = ;const pipe = ;const map = ; const source = ; // h10// h20// h30// i10// i20// i30