[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

 

 

posted @ 2016-10-10 00:44  Zhentiw  阅读(286)  评论(0编辑  收藏  举报