Skip to content

Instantly share code, notes, and snippets.

@iamso1
Last active September 5, 2017 17:02
Show Gist options
  • Save iamso1/f05b2e25284e3ad8fc78b6921d2c6036 to your computer and use it in GitHub Desktop.
Save iamso1/f05b2e25284e3ad8fc78b6921d2c6036 to your computer and use it in GitHub Desktop.
[Ramda] comparator 之謎, 如何判斷兩個參數大小 ( 以0,1,-1表示)
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