[Ramda] Complement: Logic opposite function

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Ramda] Complement: Logic opposite function相关的知识,希望对你有一定的参考价值。

Take a function as arguement, and the function only return true of false.

 

If the function ‘f‘ return ture, when complement(f) will return false.

var isEven = n => n % 2 === 0;
var isOdd = R.complement(isEven);
isOdd(21); //=> true
isOdd(42); //=> false

 

以上是关于[Ramda] Complement: Logic opposite function的主要内容,如果未能解决你的问题,请参考以下文章

[Ramda] Sort, SortBy, SortWith in Ramda

[Ramda] Change Object Properties with Ramda Lenses

[Ramda] Declaratively Map Predicates to Object Properties Using Ramda where

[Ramda] Rewrite if..else with Ramda ifElse

带有 FP 类型的 Ramda

[Ramda] Convert Object Methods into Composable Functions with Ramda