forked from OpenWF/SpaceNinjaServer
		
	chore: replace instances of find(x => x = ...) with indexOf(...)
				
					
				
			This commit is contained in:
		
							parent
							
								
									870ff2dd2c
								
							
						
					
					
						commit
						b01376f703
					
				@ -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);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -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 {
 | 
				
			||||||
 | 
				
			|||||||
@ -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;
 | 
				
			||||||
 | 
				
			|||||||
@ -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;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -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];
 | 
				
			||||||
 | 
				
			|||||||
@ -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;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user