Use strict equality

This commit is contained in:
RunasSudo 2020-10-18 16:49:53 +11:00
parent 907c296337
commit 2f50d1c22d
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 11 additions and 11 deletions

View File

@ -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 {

View File

@ -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);
}