diff --git a/test.html b/test.html index e1190e8..f4c7714 100644 --- a/test.html +++ b/test.html @@ -57,7 +57,7 @@ let election, elComment, elExhausted1, elExhausted2, elLTF1, elLTF2, elTotal, elQuota; worker.onmessage = function(evt) { - if (evt.data.type == 'init') { + if (evt.data.type === 'init') { election = evt.data.election; // Comment row @@ -133,7 +133,7 @@ tblResults.appendChild(elQuota); } - if (evt.data.type == 'result') { + if (evt.data.type === 'result') { let result = evt.data.result; // Display results @@ -146,9 +146,9 @@ elTd = document.createElement('td'); elTd.classList.add('count'); - if (countCard.state == py.pyRCV2.model.CandidateState.WITHDRAWN || countCard.state == py.pyRCV2.model.CandidateState.EXCLUDED) { + if (countCard.state === py.pyRCV2.model.CandidateState.WITHDRAWN || countCard.state === py.pyRCV2.model.CandidateState.EXCLUDED) { elTd.classList.add('excluded'); - } else if (countCard.state == py.pyRCV2.model.CandidateState.ELECTED || countCard.state == py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) { + } else if (countCard.state === py.pyRCV2.model.CandidateState.ELECTED || countCard.state === py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) { elTd.classList.add('elected'); } elTd.style.borderTop = '1px solid black'; @@ -159,16 +159,16 @@ elTd = document.createElement('td'); elTd.classList.add('count'); - if (countCard.state == py.pyRCV2.model.CandidateState.WITHDRAWN) { + if (countCard.state === py.pyRCV2.model.CandidateState.WITHDRAWN) { elTd.classList.add('excluded'); elTd.innerText = 'WD'; - } else if (countCard.state == py.pyRCV2.model.CandidateState.ELECTED || countCard.state == py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) { + } else if (countCard.state === py.pyRCV2.model.CandidateState.ELECTED || countCard.state === py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) { elTd.classList.add('elected'); elTd.innerText = countCard.votes; elTd.style.fontWeight = 'bold'; elTr1.querySelector('td:first-child').classList.add('elected'); - } else if (countCard.state == py.pyRCV2.model.CandidateState.EXCLUDED) { + } else if (countCard.state === py.pyRCV2.model.CandidateState.EXCLUDED) { elTd.classList.add('excluded'); elTd.innerText = 'EX'; } else { diff --git a/worker.js b/worker.js index 15c452d..02d1b84 100644 --- a/worker.js +++ b/worker.js @@ -5,16 +5,16 @@ function sleep(ms) { } onmessage = async function(evt) { - if (evt.data.numbers == 'native') { + if (evt.data.numbers === 'native') { py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.Native); } - if (evt.data.numbers == 'int') { + if (evt.data.numbers === 'int') { py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.NativeInt); } - if (evt.data.numbers == 'rational') { + if (evt.data.numbers === 'rational') { py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.Rational); } - if (evt.data.numbers == 'fixed') { + if (evt.data.numbers === 'fixed') { py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.Fixed); }