为什么当我在ifElse
这里运行该方法时会false
记录“功能二(onTruthy)”?
var x = R.ifElse(R.T, function(){
console.log("function two (onTruthy)")
// console.log(arguments)
}, function(){
console.log("function three (onFalsy)")
// console.log(arguments)
})
x(false)
我在想这是因为 RT 总是返回 true。也许使用_.isMatch我可以匹配它?
更新:刚试过:
var x = R.pipe(
R.partialRight(R.match, true),
R.partialRight(R.ifElse, function(){
console.log("function two (onTruthy)")
// console.log(arguments)
}, function(){
console.log("function three (onFalsy)")
// console.log(arguments)
})
)