UNPKG
@prelude/cmp
Version:
latest (4.2.0)
4.2.0
4.1.0
4.0.0
3.0.0
2.0.0
1.5.0
1.4.3
1.4.2
1.4.1
1.4.0
1.3.1
1.3.0
1.2.0
1.1.0
1.0.0
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.2
Cmp module.
@prelude/cmp
/
src
/
curry.ts
11 lines
(8 loc)
•
306 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
import
type
{
Cmp
,
Cmp1
}
from
'./prelude.js'
/**
@returns
curried comparision function by prefilling left or right hand side. */
const
curry = <T>(
cmp
:
Cmp
<T>,
a
: T,
position
:
'lhs'
|
'rhs'
=
'lhs'
):
Cmp1
<T> => position ===
'lhs'
?
_
=>
cmp
(a, _) :
_
=>
cmp
(_, a)
export
default
curry