UNPKG
moy-fp
Version:
latest (1.3.5)
1.3.5
1.3.4
1.3.3
1.3.2
1.2.2
1.2.1
0.36.9
0.36.8
0.25.1
0.25.0
A functional programming library.
github.com/MurakamiKennzo/moy-fp
MurakamiKennzo/moy-fp
moy-fp
/
src
/
Function
/
ascend.js
14 lines
(11 loc)
•
224 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import
curry
from
'./curry'
/** * Ord b => (a -> b) -> a -> a -> Number */
const
ascend =
curry
(
(
fn, a, b
) =>
{
const
aa =
fn
(a), bb =
fn
(b)
return
aa > bb ?
1
: aa === bb ?
0
: -
1
} )
export
default
ascend