forked from mirrors/0ad
Fix autofixable eslint warnings for eqeqeq
Ref: #7812 Pull Request: #8129
This commit is contained in:
@@ -57,7 +57,7 @@ var g_PluralTranslationsWithContext = {};
|
||||
|
||||
function isTranslatableString(message)
|
||||
{
|
||||
return typeof message == "string" && !!message.trim();
|
||||
return typeof message === "string" && !!message.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -88,7 +88,7 @@ function validateMod(folder, modData, notify)
|
||||
valid = false;
|
||||
}
|
||||
|
||||
if (typeof modData[propertyName] != property.type)
|
||||
if (typeof modData[propertyName] !== property.type)
|
||||
{
|
||||
if (notify)
|
||||
warn(propertyName + " in mod '" + folder + "' is not of the type '" + property.type + "'!");
|
||||
|
||||
@@ -75,7 +75,7 @@ function deepCompare(first, second)
|
||||
// check what type one of the objects is, and then compare them.
|
||||
|
||||
// Check numbers seperately. Make sure this works with NaN, Infinity etc.
|
||||
if (typeof first == "number")
|
||||
if (typeof first === "number")
|
||||
return uneval(first) === uneval(second);
|
||||
|
||||
// Functions and RegExps must have the same reference to be equal.
|
||||
|
||||
@@ -121,7 +121,7 @@ function formatPlayerInfo(playerDataArray, playerStates)
|
||||
coloredText(
|
||||
(g_Buddies.indexOf(playerNick) != -1 ? g_BuddySymbol + " " : "") +
|
||||
escapeText(playerData.Name),
|
||||
(typeof getPlayerColor == 'function' ?
|
||||
(typeof getPlayerColor === 'function' ?
|
||||
(isAI ? "white" : getPlayerColor(playerNick)) :
|
||||
rgbToGuiColor(playerData.Color || g_Settings.PlayerDefaults[playerIdx].Color))),
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ function updateTutorial(notification)
|
||||
|
||||
const notificationText =
|
||||
notification.instructions.reduce((instructions, item) =>
|
||||
instructions + (typeof item == "string" ? translate(item) : colorizeHotkey(translate(item.text), item.hotkey)),
|
||||
instructions + (typeof item === "string" ? translate(item) : colorizeHotkey(translate(item.text), item.hotkey)),
|
||||
"");
|
||||
|
||||
Engine.GetGUIObjectByName("tutorialText").caption = g_TutorialMessages.concat(setStringTags(notificationText, g_TutorialNewMessageTags)).join("\n");
|
||||
@@ -601,7 +601,7 @@ function openDialog(dialogName, data, player)
|
||||
for (const key in data[objName])
|
||||
{
|
||||
const n = data[objName][key];
|
||||
if (typeof n == "object" && n.message)
|
||||
if (typeof n === "object" && n.message)
|
||||
{
|
||||
let message = n.message;
|
||||
if (n.translateMessage)
|
||||
|
||||
@@ -12,7 +12,7 @@ function calculateRatio(divident, divisor)
|
||||
|
||||
function formatSummaryValue(values)
|
||||
{
|
||||
if (typeof values != "object")
|
||||
if (typeof values !== "object")
|
||||
return values === Infinity ? g_InfinitySymbol : values;
|
||||
|
||||
let ret = "";
|
||||
@@ -81,7 +81,7 @@ function summaryAddObject(obj1, obj2)
|
||||
function summaryArraySum(array)
|
||||
{
|
||||
return array.reduce((sum, val) => {
|
||||
if (typeof sum != "object")
|
||||
if (typeof sum !== "object")
|
||||
return sum + val;
|
||||
summaryAddObject(sum, val);
|
||||
return sum;
|
||||
|
||||
@@ -319,7 +319,7 @@ function updateTypeDropdown(number, category, item, itemNumber)
|
||||
{
|
||||
const testValue = g_ScorePanelsData[category].counters[itemNumber].fn(g_GameData.sim.playerStates[1], 0, item);
|
||||
const hide = !g_ScorePanelsData[category].counters[itemNumber].fn ||
|
||||
typeof testValue != "object" || Object.keys(testValue).length < 2;
|
||||
typeof testValue !== "object" || Object.keys(testValue).length < 2;
|
||||
Engine.GetGUIObjectByName("chart[" + number + "]TypeLabel").hidden = hide;
|
||||
const chartType = Engine.GetGUIObjectByName("chart[" + number + "]TypeSelection");
|
||||
chartType.hidden = hide;
|
||||
|
||||
@@ -49,7 +49,7 @@ function loadBiomeFile(file)
|
||||
const copyProperties = (from, to) => {
|
||||
for (const prop in from)
|
||||
{
|
||||
if (from[prop] !== null && typeof from[prop] == "object" && !Array.isArray(from[prop]))
|
||||
if (from[prop] !== null && typeof from[prop] === "object" && !Array.isArray(from[prop]))
|
||||
{
|
||||
if (!to[prop])
|
||||
to[prop] = {};
|
||||
|
||||
@@ -23,7 +23,7 @@ function RandomMap(baseHeight, baseTerrain)
|
||||
|
||||
for (let z = 0; z < this.size; ++z)
|
||||
this.texture[x][z] = this.getTextureID(
|
||||
typeof baseTerrain == "string" ? baseTerrain : pickRandom(baseTerrain));
|
||||
typeof baseTerrain === "string" ? baseTerrain : pickRandom(baseTerrain));
|
||||
}
|
||||
|
||||
// Create 2D arrays for terrain objects and areas
|
||||
|
||||
@@ -212,7 +212,7 @@ function createObjectGroupsByAreas(group, player, constraints, amount, retryFact
|
||||
|
||||
function createTerrain(terrain)
|
||||
{
|
||||
return typeof terrain == "string" ?
|
||||
return typeof terrain === "string" ?
|
||||
new SimpleTerrain(...terrain.split(TERRAIN_SEPARATOR)) :
|
||||
new RandomTerrain(terrain.map(t => createTerrain(t)));
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export function* generateMap(mapSettings)
|
||||
*/
|
||||
function getArray(stringOrArrayOfStrings)
|
||||
{
|
||||
if (typeof stringOrArrayOfStrings == "string")
|
||||
if (typeof stringOrArrayOfStrings === "string")
|
||||
return [stringOrArrayOfStrings];
|
||||
return stringOrArrayOfStrings;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ Trigger.prototype.InitTutorial = function(data)
|
||||
{
|
||||
for (const key in goal)
|
||||
{
|
||||
if (typeof goal[key] != "function" || this.tutorialEvents.indexOf(key) != -1)
|
||||
if (typeof goal[key] !== "function" || this.tutorialEvents.indexOf(key) != -1)
|
||||
continue;
|
||||
if (key == "Init")
|
||||
continue;
|
||||
@@ -85,7 +85,7 @@ Trigger.prototype.GoalMessage = function(instructions, readyButton=false, leave=
|
||||
cmpGUIInterface.PushNotification({
|
||||
"type": "tutorial",
|
||||
"players": [1],
|
||||
"instructions": typeof instructions == "string" ? [instructions] : instructions,
|
||||
"instructions": typeof instructions === "string" ? [instructions] : instructions,
|
||||
"readyButton": readyButton,
|
||||
"leave": leave
|
||||
});
|
||||
|
||||
@@ -80,7 +80,7 @@ m.EntityCollection.prototype.toString = function()
|
||||
|
||||
m.EntityCollection.prototype.filter = function(filter, thisp)
|
||||
{
|
||||
if (typeof filter == "function")
|
||||
if (typeof filter === "function")
|
||||
filter = { "func": filter, "dynamicProperties": [] };
|
||||
|
||||
const ret = new Map();
|
||||
|
||||
@@ -50,7 +50,7 @@ AIInterface.prototype.Serialize = function()
|
||||
{
|
||||
if (!Object.hasOwn(this, key))
|
||||
continue;
|
||||
if (typeof this[key] == "function")
|
||||
if (typeof this[key] === "function")
|
||||
continue;
|
||||
if (key == "templates")
|
||||
continue;
|
||||
|
||||
@@ -504,10 +504,10 @@ StatisticsTracker.prototype.UpdatePeakPercentages = function()
|
||||
**/
|
||||
StatisticsTracker.prototype.PushValue = function(fromData, toData)
|
||||
{
|
||||
if (typeof fromData == "object")
|
||||
if (typeof fromData === "object")
|
||||
for (const prop in fromData)
|
||||
{
|
||||
if (typeof toData[prop] != "object")
|
||||
if (typeof toData[prop] !== "object")
|
||||
toData[prop] = [fromData[prop]];
|
||||
else
|
||||
this.PushValue(fromData[prop], toData[prop]);
|
||||
|
||||
@@ -64,7 +64,7 @@ global.TS_ASSERT_EXCEPTION = function(func)
|
||||
|
||||
global.TS_ASSERT_NUMBER = function(value)
|
||||
{
|
||||
if (typeof value != "number" || !isFinite(value))
|
||||
if (typeof value !== "number" || !isFinite(value))
|
||||
fail("The given value must be a real number!");
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user