Skip to content

Commit

Permalink
Update weather.js
Browse files Browse the repository at this point in the history
I added semicolons and even more spaces.
  • Loading branch information
samuellouf committed Aug 5, 2023
1 parent 96b4c20 commit 1108a08
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions extensions/SamuelLouf/weather.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@
return fetched_json.current_weather;
}


const letters_of = (text, from, to) => {
args.STRING = text.toString();

Check failure on line 73 in extensions/SamuelLouf/weather.js

View workflow job for this annotation

GitHub Actions / build

'args' is not defined
args.LETTER1 = Number(from) || 0;args.LETTER2 = Number(to) || 0;

Check failure on line 74 in extensions/SamuelLouf/weather.js

View workflow job for this annotation

GitHub Actions / build

'args' is not defined

Check failure on line 74 in extensions/SamuelLouf/weather.js

View workflow job for this annotation

GitHub Actions / build

'args' is not defined
return args.STRING.substring(args.LETTER1 - 1, args.LETTER2);

Check failure on line 75 in extensions/SamuelLouf/weather.js

View workflow job for this annotation

GitHub Actions / build

'args' is not defined

Check failure on line 75 in extensions/SamuelLouf/weather.js

View workflow job for this annotation

GitHub Actions / build

'args' is not defined

Check failure on line 75 in extensions/SamuelLouf/weather.js

View workflow job for this annotation

GitHub Actions / build

'args' is not defined
}

Check warning on line 76 in extensions/SamuelLouf/weather.js

View workflow job for this annotation

GitHub Actions / build

Missing semicolon

Check warning on line 77 in extensions/SamuelLouf/weather.js

View workflow job for this annotation

GitHub Actions / build

Trailing spaces not allowed
const itemOfFromString = (no, from, splitby) => {
var input1 = (Number(no) - 1);
var input2 = String(from);
var input3 = splitby;
return input2.split(input3)[input1] || '';
}

Check warning on line 83 in extensions/SamuelLouf/weather.js

View workflow job for this annotation

GitHub Actions / build

Missing semicolon

class Weather {
getInfo() {
return {
Expand Down Expand Up @@ -327,8 +341,6 @@
return current_weather.temperature;
} else {
var temperature = (current_weather.temperature * 9 / 5) + 32;
const letters_of = (text, from, to) => {args.STRING = text.toString();args.LETTER1 = Number(from) || 0;args.LETTER2 = Number(to) || 0;return args.STRING.substring(args.LETTER1 - 1, args.LETTER2);}
const itemOfFromString = (no, from, splitby) => {var input1 = (Number(no) - 1);var input2 = String(from);var input3 = splitby;return input2.split(input3)[input1] || '';}
return Number(String(itemOfFromString(1, temperature, '.')) + '.' + letters_of(itemOfFromString(2, temperature, '.'), 1, 2));
}
} else if (args.METEO == 'all (JSON)'){
Expand All @@ -338,8 +350,6 @@
return current_weather.windspeed;
} else {
var wind_speed = current_weather.windspeed / 1.609;
const letters_of = (text, from, to) => {args.STRING = text.toString();args.LETTER1 = Number(from) || 0;args.LETTER2 = Number(to) || 0;return args.STRING.substring(args.LETTER1 - 1, args.LETTER2);}
const itemOfFromString = (no, from, splitby) => {var input1 = (Number(no) - 1);var input2 = String(from);var input3 = splitby;return input2.split(input3)[input1] || '';}
return Number(String(itemOfFromString(1, wind_speed, '.')) + '.' + letters_of(itemOfFromString(2, wind_speed, '.'), 1, 2));
}
} else {
Expand Down Expand Up @@ -377,7 +387,7 @@
}

async get_current_weather_in (args){
var geolocation_of_place = await Scratch.fetch('https://geocode.maps.co/search?q='+escape(args.place)).then(r => r.text()).catch(() => '');
var geolocation_of_place = await Scratch.fetch('https://geocode.maps.co/search?q=' + encodeURIComponent(args.place)).then(r => r.text()).catch(() => '');
geolocation_of_place = JSON.parse(geolocation_of_place);
var current_weather = await getCurrentWeather({latitude: Number(geolocation_of_place[0].lat), longitude: Number(geolocation_of_place[0].lon)});

Expand All @@ -386,8 +396,6 @@
return current_weather.temperature;
} else {
var temperature = (current_weather.temperature * 9 / 5 ) + 32;
const letters_of = (text, from, to) => {args.STRING = text.toString();args.LETTER1 = Number(from) || 0;args.LETTER2 = Number(to) || 0;return args.STRING.substring(args.LETTER1 - 1, args.LETTER2);}
const itemOfFromString = (no, from, splitby) => {var input1 = (Number(no) - 1);var input2 = String(from);var input3 = splitby;return input2.split(input3)[input1] || '';}
return Number(String(itemOfFromString(1, temperature, '.')) + '.' + letters_of(itemOfFromString(2, temperature, '.'), 1, 2));
}
} else if (args.METEO == 'all (JSON)'){
Expand All @@ -397,8 +405,6 @@
return current_weather.windspeed;
} else {
var wind_speed = current_weather.windspeed / 1.609;
const letters_of = (text, from, to) => {args.STRING = text.toString();args.LETTER1 = Number(from) || 0;args.LETTER2 = Number(to) || 0;return args.STRING.substring(args.LETTER1 - 1, args.LETTER2);}
const itemOfFromString = (no, from, splitby) => {var input1 = (Number(no) - 1);var input2 = String(from);var input3 = splitby;return input2.split(input3)[input1] || '';}
return Number(String(itemOfFromString(1, wind_speed, '.')) + '.' + letters_of(itemOfFromString(2, wind_speed, '.'), 1, 2));
}
} else {
Expand All @@ -418,8 +424,6 @@
return current_weather.temperature;
} else {
var temperature = (current_weather.temperature * 9 / 5) + 32;
const letters_of = (text, from, to) => {args.STRING = text.toString();args.LETTER1 = Number(from) || 0;args.LETTER2 = Number(to) || 0;return args.STRING.substring(args.LETTER1 - 1, args.LETTER2);}
const itemOfFromString = (no, from, splitby) => {var input1 = (Number(no) - 1);var input2 = String(from);var input3 = splitby;return input2.split(input3)[input1] || '';}
return Number(String(itemOfFromString(1, temperature, '.')) + '.' + letters_of(itemOfFromString(2, temperature, '.'), 1, 2));
}
} else if (args.METEO == 'all (JSON)'){
Expand All @@ -429,8 +433,6 @@
return current_weather.windspeed;
} else {
var wind_speed = current_weather.windspeed / 1.609;
const letters_of = (text, from, to) => {args.STRING = text.toString();args.LETTER1 = Number(from) || 0;args.LETTER2 = Number(to) || 0;return args.STRING.substring(args.LETTER1 - 1, args.LETTER2);}
const itemOfFromString = (no, from, splitby) => {var input1 = (Number(no) - 1);var input2 = String(from);var input3 = splitby;return input2.split(input3)[input1] || '';}
return Number(String(itemOfFromString(1, wind_speed, '.')) + '.' + letters_of(itemOfFromString(2, wind_speed, '.'), 1, 2));
}
} else {
Expand All @@ -451,7 +453,7 @@
if (args.METEO.includes('(C)')){
return Number(args.value) - 2.5 < Number(response) && Number(response) < Number(args.value) + 2.5;
} else {
return Number(args.value) - 3.6 < Number(response) && Number(response) < Number(args.value)+3.6;
return Number(args.value) - 3.6 < Number(response) && Number(response) < Number(args.value) + 3.6;
}
} else if (args.METEO.includes('wind speed')){
if (args.METEO.includes('(km/h)')){
Expand Down

0 comments on commit 1108a08

Please sign in to comment.