Is there a Variadic Version of either (R.either)?
问题 I have a need for a variadic version of R.either . After doing some searching around the web, I have not found a solution. R.anyPass would work but it returns a Boolean instead of the original value. Is there already a solution that I have overlooked? If not, what would be the most optimal way to write a variadic either utility function? An example: const test = variadicEither(R.multiply(0), R.add(-1), R.add(1), R.add(2)) test(1) // => 2 回答1: You could use a combination of reduce + reduced :