UNPKG
@prelude/function
Version:
latest (0.4.1)
0.4.1
0.4.0
0.3.0
0.2.0
0.1.0
0.0.3
Function module.
@prelude/function
/
src
/
xor.ts
16 lines
(13 loc)
•
338 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import
type
{
Predicate
}
from
'./prelude.js'
/**
@returns
boolean logic exlusive-or from provided predicates. */
const
xor = <A, B>
(
a
:
Predicate
<A>,
b
:
Predicate
<B>
) =>
(
value
: A & B
) =>
a
(value) ?
b
(value) ?
false
:
true
:
b
(value) ?
true
:
false
export
default
xor