Last active
September 5, 2017 17:02
-
-
Save iamso1/f05b2e25284e3ad8fc78b6921d2c6036 to your computer and use it in GitHub Desktop.
[Ramda] comparator 之謎, 如何判斷兩個參數大小 ( 以0,1,-1表示)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = _curry1(function comparator(pred) { | |
return function(a, b) { | |
return pred(a, b) ? -1 : pred(b, a) ? 1 : 0; | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment