Closed jshthornton closed 7 years ago
Hi, thanks for opening an issue! Another option is simply to modify the current select function so that the signature takes in any number of args, like: select (...args)
, which is how ofType
works in redux-observable.
I couldn't think of a use case for this when I first wrote the function though. I figured it would be a rare case and that people could just use select
multiple times and then combine those resulting streams if needed.
Can you give me some example situations of when you'd like to be able to select multiple actions simultaneously?
@jshthornton @Vlad-Zhukov Any thoughts? Would you prefer to have a separate selectAny
or maybe selectArray
alongside of select
or simply allow select to take a variable amount of arguments like select(ACTION_TYPE_1, ACTION_TYPE_2, ACTION_TYPE_3, ...)
?
Also, can you provide me some examples where you feel you need to filter for multiple actions at the same time before we make a decision about it? I'd like to have a better understanding of the intent.
@joshburgess I would recommend having another method. Purely because functional programming prefers to have a known number of arguments. And thus trying to keep backwards compatibility. I opted for selectAny
as it matches ramda's naming convention.
@jshthornton Ramda also uses N in some cases to mean Any, right? like curryN? Although I suppose that's different, because you're passing the number of arguments in as the first param.
Ok, I'm good with adding selectAny which takes an array. Would you like to add it and make a pull request? 👍
@joshburgess I will take care of this feature.
It is a common requirement to have to listen in to multiple actions for a given stream.
I propose a new operator called
selectAny
which is given an array of types as the first param. Then if any type matches it will filter through.