Closed ricardo-devis-agullo closed 6 years ago
I think it's a hint that it's mutating the stream passed in.
There is a module called takeUntil. But that has its own problems e.g. the argument order is (src, end)
but it does not mutate your stream.
using takeUntil you could do:
const takeUntil = R.flip(require('flyd/module/takeuntil'));
const interval$ = R.compose(
takeUntil(stream$.end),
flyd.debounceTime(bounceTime || 0),
flyd.mergeAll
)(sources);
It's also rather curious to see you've extended the flyd object. You could always just
flyd.endsOn = flyd.curryN(2, flyd.endsOn);
Oh, I see, I guess it makes sense. I didn't know that endsOn mutated the stream.
The takeUntil seems to do the trick :)
And yeah, I forgot to mention that I had an extended flyd object :P I don't change already existing methods, but I can always come up with a different name for the flipped takeUntil (I already had takeUntil on the extended flyd object ^_^)
Thanks!
Closing this as I think takeUntil solves it :smile: Feel free to reopen if you feel this hasn't been resolved properly.
Why flyd.endsOn is not curried?
Other 2-param functions like map, or merge are, so I wonder if there's any reason behind it. I had in my code something like this:
And had to convert it to
to make it work. I was thinking of exporting myself a version of endsOn that is curried, but wondered if there's any problem doing that.
Thank you!