您可能可以使用类似的方法来扩展异步管道tap https://ramdajs.com/docs/#tap:
const loginFlow = asyncPipe(
// ... some functions
getHouseList,
tap(compose(dispatch, addHouses)),
tap(unless(list => list.length > 1, list => dispatch(pickHouse(list[0])))),
list => navigate(list.length > 1 ? 'ListScreen' : 'DetailScreen', list)
);
这是否值得做将取决于您的应用程序。如果管道已经很长,那么以这种方式将东西添加到末尾可能会更干净,即使它们不是特别功能的部分。但对于较短的管道来说,这可能没有多大意义。
您可能还想看看现已弃用的,pipeP https://ramdajs.com/docs/#pipeP或其替代品,pipeWith https://ramdajs.com/docs/#pipeWith(then https://ramdajs.com/docs/#then).
但是您在标题中询问了有关分叉参数的问题。拉姆达的converge https://ramdajs.com/docs/#converge正是这样做的:
converge(f, [g, h])(x) //=> f(g(x), h(x))
这允许您传递两个以上的函数,并将多个参数传递给结果函数:
converge(f, [g, h, i])(x, y) //=> f(g(x, y), h(x, y), i(x, y))