From 86bb73df500668d1a6641ac11817e7f5325acc2e Mon Sep 17 00:00:00 2001 From: MineFact Date: Fri, 26 Jan 2024 07:35:51 -0600 Subject: [PATCH] copy info object to prevent editing the original --- src/struct/core/buildteam.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/struct/core/buildteam.ts b/src/struct/core/buildteam.ts index 6cd8209..3679095 100644 --- a/src/struct/core/buildteam.ts +++ b/src/struct/core/buildteam.ts @@ -168,7 +168,10 @@ export default class BuildTeam { // BuildTeamInfo is a json array with one object per buildteam - const info = this.network.buildTeamInfo.filter((info: any) => info.APIKey == this.apiKey)[0]; + let info = this.network.buildTeamInfo.filter((info: any) => info.APIKey == this.apiKey)[0]; + + // Make a copy of the object + info = JSON.parse(JSON.stringify(info)); if(info == null){ console.log("Build Team Info could not be found by API Key in loadBuildTeamInfo(). API Key: " + this.apiKey + " | API Keys in BuildTeamInfo: " + this.network.buildTeamInfo.map((info: any) => info.APIKey).join(", "))