chore: replace instances of find(x => x = ...) with indexOf(...)
All checks were successful
Build Docker image / docker (push) Successful in 1m16s
Build / build (push) Successful in 1m50s

This commit is contained in:
Sainan 2025-05-17 09:17:03 +02:00
parent 870ff2dd2c
commit b01376f703
6 changed files with 6 additions and 6 deletions

View File

@ -340,7 +340,7 @@ export const getInventoryResponse = async (
}; };
const addString = (arr: string[], str: string): void => { const addString = (arr: string[], str: string): void => {
if (!arr.find(x => x == str)) { if (arr.indexOf(str) == -1) {
arr.push(str); arr.push(str);
} }
}; };

View File

@ -26,7 +26,7 @@ export const loginRewardsSelectionController: RequestHandler = async (req, res)
StoreItemType: body.ChosenReward StoreItemType: body.ChosenReward
}; };
inventoryChanges = (await handleStoreItemAcquisition(body.ChosenReward, inventory)).InventoryChanges; inventoryChanges = (await handleStoreItemAcquisition(body.ChosenReward, inventory)).InventoryChanges;
if (!evergreenRewards.find(x => x == body.ChosenReward)) { if (evergreenRewards.indexOf(body.ChosenReward) == -1) {
inventory.LoginMilestoneRewards.push(body.ChosenReward); inventory.LoginMilestoneRewards.push(body.ChosenReward);
} }
} else { } else {

View File

@ -177,7 +177,7 @@ export const nemesisController: RequestHandler = async (req, res) => {
weaponIdx = initialWeaponIdx; weaponIdx = initialWeaponIdx;
do { do {
const weapon = weapons[weaponIdx]; const weapon = weapons[weaponIdx];
if (!body.target.DisallowedWeapons.find(x => x == weapon)) { if (body.target.DisallowedWeapons.indexOf(weapon) == -1) {
break; break;
} }
weaponIdx = (weaponIdx + 1) % weapons.length; weaponIdx = (weaponIdx + 1) % weapons.length;

View File

@ -445,7 +445,7 @@ export const addGuildMemberShipDecoContribution = (guildMember: IGuildMemberData
export const processDojoBuildMaterialsGathered = (guild: TGuildDatabaseDocument, build: IDojoBuild): void => { export const processDojoBuildMaterialsGathered = (guild: TGuildDatabaseDocument, build: IDojoBuild): void => {
if (build.guildXpValue) { if (build.guildXpValue) {
guild.ClaimedXP ??= []; guild.ClaimedXP ??= [];
if (!guild.ClaimedXP.find(x => x == build.resultType)) { if (guild.ClaimedXP.indexOf(build.resultType) == -1) {
guild.ClaimedXP.push(build.resultType); guild.ClaimedXP.push(build.resultType);
guild.XP += build.guildXpValue; guild.XP += build.guildXpValue;
} }

View File

@ -90,7 +90,7 @@ export const getAccountIdForRequest = async (req: Request): Promise<string> => {
}; };
export const isAdministrator = (account: TAccountDocument): boolean => { export const isAdministrator = (account: TAccountDocument): boolean => {
return !!config.administratorNames?.find(x => x == account.DisplayName); return config.administratorNames?.indexOf(account.DisplayName) != -1;
}; };
const platform_magics = [753, 639, 247, 37, 60]; const platform_magics = [753, 639, 247, 37, 60];

View File

@ -383,7 +383,7 @@ export const addMissionInventoryUpdates = async (
} }
if ( if (
inventory.LibraryActiveDailyTaskInfo && inventory.LibraryActiveDailyTaskInfo &&
inventory.LibraryActiveDailyTaskInfo.EnemyTypes.find(x => x == scan.EnemyType) inventory.LibraryActiveDailyTaskInfo.EnemyTypes.indexOf(scan.EnemyType) != -1
) { ) {
inventory.LibraryActiveDailyTaskInfo.Scans ??= 0; inventory.LibraryActiveDailyTaskInfo.Scans ??= 0;
inventory.LibraryActiveDailyTaskInfo.Scans += scan.Count; inventory.LibraryActiveDailyTaskInfo.Scans += scan.Count;