[英]Ramda Negation In Both
Why does the following fail to return a function? 为什么以下代码无法返回函数?
const isValid = both(not(isEmpty), is(Object));
The item is valid if it: 该项目在以下情况下有效:
As mentioned in my comment, not
is, ahem, not what you want. 如我的评论所述,
not
, 不是 , 不是您想要的。 Instead, try complement
: 相反,尝试
complement
:
const isValid = R.both(R.complement(R.isEmpty), R.is(Array)); console.log(isValid); console.log(isValid([1,2,3]));
<script src="https://cdn.jsdelivr.net/npm/ramda@latest/dist/ramda.min.js"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.