-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathweatherupdater.js
60 lines (54 loc) · 2.04 KB
/
weatherupdater.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const weatherData = require("./weatherData.json");
const weather = require("./weather.json")
const weatherStatus = require("./weatherStatus.json");
const fs = require("fs");
module.exports = {
rainy: function UpdateR() {
weather.N = "Rainy"
weather.C = weatherStatus.RC;
weather.E1 = weatherStatus.RE1;
weather.icon = weatherStatus.RE2;
weather.D = weatherStatus.RD;
fs.writeFile("./weather.json", JSON.stringify(weather), (err) => console.error);
},
snowy: function UpdateS() {
weather.N = "Snowy"
weather.C = weatherStatus.SNC;
weather.E1 = weatherStatus.SNE1;
weather.icon = weatherStatus.SNE2;
weather.D = weatherStatus.SND;
fs.writeFile("./weather.json", JSON.stringify(weather), (err) => console.error);
},
stormy: function UpdateT() {
weather.N = "Stormy"
weather.C = weatherStatus.TC;
weather.E1 = weatherStatus.TE1;
weather.icon = weatherStatus.TE2;
weather.D = weatherStatus.TD;
fs.writeFile("./weather.json", JSON.stringify(weather), (err) => console.error);
},
windy: function UpdateW() {
weather.N = "Windy"
weather.C = weatherStatus.WC;
weather.E1 = weatherStatus.WE1;
weather.icon = weatherStatus.WE2;
weather.D = weatherStatus.WD;
fs.writeFile("./weather.json", JSON.stringify(weather), (err) => console.error);
},
cloudy: function UpdateC() {
weather.N = "Cloudy"
weather.C = weatherStatus.CC;
weather.E1 = weatherStatus.CE1;
weather.icon = weatherStatus.CE2;
weather.D = weatherStatus.CD;
fs.writeFile("./weather.json", JSON.stringify(weather), (err) => console.error);
},
sunny: function UpdateSu() {
weather.N = "Sunny"
weather.C = weatherStatus.SC;
weather.E1 = weatherStatus.SE1;
weather.icon = weatherStatus.SE2;
weather.D = weatherStatus.SD;
fs.writeFile("./weather.json", JSON.stringify(weather), (err) => console.error);
}
};