aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEvan <[email protected]>2023-02-26 10:27:11 -0600
committerEvan <[email protected]>2023-02-26 10:27:11 -0600
commit2345cc23b69e0099aa2ded75c97a0abfdf3257de (patch)
tree3d66f7dc4c7e99a96a4f22780b7c1ef820f75756
parent201b185f74a2e07e8ce62b3c7618374b5ae48374 (diff)
downloadmonkeytype-2345cc23b69e0099aa2ded75c97a0abfdf3257de.tar.gz
monkeytype-2345cc23b69e0099aa2ded75c97a0abfdf3257de.zip
== -> === in a few more files
-rw-r--r--frontend/src/ts/test/funbox/funbox.ts10
-rw-r--r--frontend/src/ts/test/funbox/memory-funbox-timer.ts2
-rw-r--r--frontend/src/ts/test/wikipedia.ts8
-rw-r--r--frontend/src/ts/test/wordset.ts2
-rw-r--r--frontend/src/ts/utils/misc.ts32
5 files changed, 27 insertions, 27 deletions
diff --git a/frontend/src/ts/test/funbox/funbox.ts b/frontend/src/ts/test/funbox/funbox.ts
index b87568d81..99f101f06 100644
--- a/frontend/src/ts/test/funbox/funbox.ts
+++ b/frontend/src/ts/test/funbox/funbox.ts
@@ -87,7 +87,7 @@ class PseudolangWordGenerator extends Misc.Wordset {
}
// Pick a random char from the distribution that comes after `prefix`.
const nextChar = charDistribution.randomChar();
- if (nextChar == " ") {
+ if (nextChar === " ") {
// A space marks the end of the word, so stop generating and return.
break;
}
@@ -144,7 +144,7 @@ FunboxList.setFunboxFunctions("tts", {
save("keymapMode", Config.keymapMode, UpdateConfig.setKeymapMode);
},
toggleScript(params: string[]): void {
- if (window.speechSynthesis == undefined) {
+ if (window.speechSynthesis === undefined) {
Notifications.add("Failed to load text-to-speech script", -1);
return;
}
@@ -237,7 +237,7 @@ FunboxList.setFunboxFunctions("rAnDoMcAsE", {
alterText(word: string): string {
let randomcaseword = word[0];
for (let i = 1; i < word.length; i++) {
- if (randomcaseword[i - 1] == randomcaseword[i - 1].toUpperCase()) {
+ if (randomcaseword[i - 1] === randomcaseword[i - 1].toUpperCase()) {
randomcaseword += word[i].toLowerCase();
} else {
randomcaseword += word[i].toUpperCase();
@@ -545,7 +545,7 @@ export function setFunbox(funbox: string): boolean {
}
export function toggleFunbox(funbox: string): boolean {
- if (funbox == "none") setFunbox("none");
+ if (funbox === "none") setFunbox("none");
if (
!areFunboxesCompatible(Config.funbox, funbox) &&
!Config.funbox.split("#").includes(funbox)
@@ -577,7 +577,7 @@ export async function clear(): Promise<boolean> {
export async function activate(funbox?: string): Promise<boolean | undefined> {
if (funbox === undefined || funbox === null) {
funbox = Config.funbox;
- } else if (Config.funbox != funbox) {
+ } else if (Config.funbox !== funbox) {
Config.funbox = funbox;
}
diff --git a/frontend/src/ts/test/funbox/memory-funbox-timer.ts b/frontend/src/ts/test/funbox/memory-funbox-timer.ts
index 6c9523242..df851e747 100644
--- a/frontend/src/ts/test/funbox/memory-funbox-timer.ts
+++ b/frontend/src/ts/test/funbox/memory-funbox-timer.ts
@@ -38,7 +38,7 @@ export function start(): void {
memoryInterval = setInterval(() => {
if (memoryTimer === null) return;
memoryTimer -= 1;
- memoryTimer == 0 ? hide() : update(memoryTimer);
+ memoryTimer === 0 ? hide() : update(memoryTimer);
if (memoryTimer <= 0) {
reset();
$("#wordsWrapper").addClass("hidden");
diff --git a/frontend/src/ts/test/wikipedia.ts b/frontend/src/ts/test/wikipedia.ts
index a9b6821bd..289f4320c 100644
--- a/frontend/src/ts/test/wikipedia.ts
+++ b/frontend/src/ts/test/wikipedia.ts
@@ -69,7 +69,7 @@ export async function getSection(language: string): Promise<Section> {
const randomPostReq = await fetch(randomPostURL);
let pageid = 0;
- if (randomPostReq.status == 200) {
+ if (randomPostReq.status === 200) {
const postObj: Post = await randomPostReq.json();
sectionObj.title = postObj.title;
sectionObj.author = postObj.author;
@@ -77,7 +77,7 @@ export async function getSection(language: string): Promise<Section> {
}
return new Promise((res, rej) => {
- if (randomPostReq.status != 200) {
+ if (randomPostReq.status !== 200) {
Loader.hide();
rej(randomPostReq.status);
}
@@ -86,8 +86,8 @@ export async function getSection(language: string): Promise<Section> {
const sectionReq = new XMLHttpRequest();
sectionReq.onload = (): void => {
- if (sectionReq.readyState == 4) {
- if (sectionReq.status == 200) {
+ if (sectionReq.readyState === 4) {
+ if (sectionReq.status === 200) {
let sectionText: string = JSON.parse(sectionReq.responseText).query
.pages[pageid.toString()].extract;
diff --git a/frontend/src/ts/test/wordset.ts b/frontend/src/ts/test/wordset.ts
index f0babff61..efde9a491 100644
--- a/frontend/src/ts/test/wordset.ts
+++ b/frontend/src/ts/test/wordset.ts
@@ -11,7 +11,7 @@ export async function withWords(words: string[]): Promise<Wordset> {
if (wordFunbox?.functions?.withWords) {
return wordFunbox.functions.withWords(words);
}
- if (currentWordset == null || words !== currentWordset.words) {
+ if (currentWordset === null || words !== currentWordset.words) {
currentWordset = new Wordset(words);
}
return currentWordset;
diff --git a/frontend/src/ts/utils/misc.ts b/frontend/src/ts/utils/misc.ts
index ad8569417..eb796bd0c 100644
--- a/frontend/src/ts/utils/misc.ts
+++ b/frontend/src/ts/utils/misc.ts
@@ -114,7 +114,7 @@ export async function getLanguage(
lang: string
): Promise<MonkeyTypes.LanguageObject> {
// try {
- if (currentLanguage == undefined || currentLanguage.name !== lang) {
+ if (currentLanguage === undefined || currentLanguage.name !== lang) {
currentLanguage = await cachedFetchJson<MonkeyTypes.LanguageObject>(
`/./languages/${lang}.json`
);
@@ -179,7 +179,7 @@ export async function getFunbox(
): Promise<MonkeyTypes.FunboxMetadata | undefined> {
const list: MonkeyTypes.FunboxMetadata[] = await getFunboxList();
return list.find(function (element) {
- return element.name == funbox;
+ return element.name === funbox;
});
}
@@ -245,11 +245,11 @@ function hexToHSL(hex: string): {
let r: number;
let g: number;
let b: number;
- if (hex.length == 4) {
+ if (hex.length === 4) {
r = ("0x" + hex[1] + hex[1]) as unknown as number;
g = ("0x" + hex[2] + hex[2]) as unknown as number;
b = ("0x" + hex[3] + hex[3]) as unknown as number;
- } else if (hex.length == 7) {
+ } else if (hex.length === 7) {
r = ("0x" + hex[1] + hex[2]) as unknown as number;
g = ("0x" + hex[3] + hex[4]) as unknown as number;
b = ("0x" + hex[5] + hex[6]) as unknown as number;
@@ -269,9 +269,9 @@ function hexToHSL(hex: string): {
let s = 0;
let l = 0;
- if (delta == 0) h = 0;
- else if (cmax == r) h = ((g - b) / delta) % 6;
- else if (cmax == g) h = (b - r) / delta + 2;
+ if (delta === 0) h = 0;
+ else if (cmax === r) h = ((g - b) / delta) % 6;
+ else if (cmax === g) h = (b - r) / delta + 2;
else h = (r - g) / delta + 4;
h = Math.round(h * 60);
@@ -279,7 +279,7 @@ function hexToHSL(hex: string): {
if (h < 0) h += 360;
l = (cmax + cmin) / 2;
- s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
+ s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
s = +(s * 100).toFixed(1);
l = +(l * 100).toFixed(1);
@@ -529,7 +529,7 @@ export function secondsToString(
if (days > 0 && showDays) {
ret += daysString;
if (delimiter === "text") {
- if (days == 1) {
+ if (days === 1) {
ret += " day ";
} else {
ret += " days ";
@@ -541,7 +541,7 @@ export function secondsToString(
if (hours > 0 || alwaysShowHours) {
ret += hoursString;
if (delimiter === "text") {
- if (hours == 1) {
+ if (hours === 1) {
ret += " hour ";
} else {
ret += " hours ";
@@ -553,7 +553,7 @@ export function secondsToString(
if (minutes > 0 || hours > 0 || alwaysShowMinutes) {
ret += minutesString;
if (delimiter === "text") {
- if (minutes == 1) {
+ if (minutes === 1) {
ret += " minute ";
} else {
ret += " minutes ";
@@ -565,7 +565,7 @@ export function secondsToString(
if (showSeconds) {
ret += secondsString;
if (delimiter === "text") {
- if (seconds == 1) {
+ if (seconds === 1) {
ret += " second";
} else {
ret += " seconds";
@@ -680,13 +680,13 @@ export function getPositionString(number: number): string {
let numend = "th";
const t = number % 10;
const h = number % 100;
- if (t == 1 && h != 11) {
+ if (t === 1 && h !== 11) {
numend = "st";
}
- if (t == 2 && h != 12) {
+ if (t === 2 && h !== 12) {
numend = "nd";
}
- if (t == 3 && h != 13) {
+ if (t === 3 && h !== 13) {
numend = "rd";
}
return number + numend;
@@ -899,7 +899,7 @@ export function canQuickRestart(
): boolean {
const wordsLong = mode === "words" && (words >= 1000 || words === 0);
const timeLong = mode === "time" && (time >= 900 || time === 0);
- const customTextLong = mode === "custom" && customTextIsLong == true;
+ const customTextLong = mode === "custom" && customTextIsLong;
const customTextRandomWordsLong =
mode === "custom" && CustomText.isWordRandom && CustomText.word >= 1000;
const customTextRandomTimeLong =