const
declarations for variables that are never reassigned JS-0242 99
100 if (data.status === 'INGAME' && data.match) {
101 let map = this.maps.find(map => map.mapUrl === data.match.map);
102 let agent = await axios.get(`https://valorant-api.com/v1/agents/${data.match.charaterID}`).then(res => res.data.data);103 this.presence = {
104 details: translate(this.language, "presence:ingame:details") + "[" + data.match.score.ally + " - " + data.match.score.enemy + ']',
105 state: data.match.mode ? (translate(this.language, `presence:pregame:type:${data.match.mode.toLowerCase()}`) ?? data.match.mode) : "Custom Game",
98 };
99
100 if (data.status === 'INGAME' && data.match) {
101 let map = this.maps.find(map => map.mapUrl === data.match.map);102 let agent = await axios.get(`https://valorant-api.com/v1/agents/${data.match.charaterID}`).then(res => res.data.data);
103 this.presence = {
104 details: translate(this.language, "presence:ingame:details") + "[" + data.match.score.ally + " - " + data.match.score.enemy + ']',
87 };
88
89 if (data.status === 'PREGAME' && data.match) {
90 let map = this.maps.find(map => map.mapUrl === data.match.map); 91 this.presence = {
92 details: translate(this.language, "presence:pregame:details"),
93 state: data.match.mode ? (translate(this.language, `presence:pregame:type:${data.match.mode.toLowerCase()}`) ?? data.match.mode) : "Custom Game",
43 return;
44 }
45
46 let data = await ValorantClient.getPlayerDetails(); 47 if (!data) {
48 this.client.clearActivity()
49 //this.clientDestroy();
36 async _init() {
37 this.maps = await axios.get('https://valorant-api.com/v1/maps').then(res => res.data.data);
38
39 let interval = setInterval(async () => { 40 this.language = store.get("language") || "tr_TR";
41 if (!this.isReady) {
42 clearInterval(interval);
Variables that are never re-assigned a new value after their initial declaration should be declared with the const
keyword.
This prevents the programmer from erroneously re-assigning to a read-only variable, and informs those reading the code that a variable is a constant value.
let pi = Math.PI
for (let x of xs) {
use(x);
}
let { a, b } = object;
use(a, b);
const pi = Math.PI
for (const x of xs) {
use(x);
}
const { a, b } = object;
use(a, b);