UNPKG
@hckrnews/logic-gates
Version:
latest (2.0.4)
2.0.4
2.0.3
2.0.2
2.0.0
1.0.2
1.0.1
1.0.0
Generate logic gates without thinking.
github.com/hckrnews/logic-gates
hckrnews/logic-gates
@hckrnews/logic-gates
/
src
/
XorGate.mjs
14 lines
(10 loc)
•
296 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import
Gate
from
'./Gate.mjs'
;
import
Helper
from
'./Helper'
;
class
XorGate
extends
Gate
{
generateOutput
(
) {
this
.
output
=
Helper
.
totalTrueInputs
(
this
.
inputs
) %
2
===
1
; } }
const
xor
= (
input
) =>
XorGate
.
create
(input).
output
;
export
default
XorGate
;
export
{
XorGate
, xor };