-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.js
94 lines (86 loc) · 2.1 KB
/
utils.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
function weatherTranslator(weather) {
const dict = {
't101d': 'gloomy',
't101n': 'gloomy+night',
't102d': 'angry',
't102n': 'angry+night',
't103d': 'angry',
't103n': 'angry+night',
't104d': 'gloomy',
't104n': 'gloomy+night',
't105d': 'hard',
't105n': 'hard+night',
'd01d': 'meditation',
'd01n': 'meditation+night',
'd02d': 'relaxing',
'd02n': 'relaxing+night',
'd03d': 'mellow',
'd03n': 'mellow+night',
'r01d': 'mellow',
'r01n': 'mellow+night',
'r02d': 'chill',
'r02n': 'chill+night',
'r03d': 'intense',
'r03n': 'intense+night',
'f01d': 'quiet',
'f01n': 'quiet+night',
'r04d': 'soothing',
'r04n': 'soothing+night',
'r05d': 'soothing',
'r05n': 'soothing+night',
'r06d': 'extreme',
'r06n': 'extreme+night',
's01d': 'peaceful',
's01n': 'peaceful+night',
's02d': 'dreamy',
's02n': 'dreamy+night',
's03d': 'blizzard',
's03n': 'blizzard+night',
's04d': 'freezing',
's04n': 'freezing+night',
's05d': 'freezing',
's05n': 'freezing+night',
's06d': 'alpine',
's06n': 'alpine+night',
'a01d': 'misty',
'a01n': 'misty+night',
'a02d': 'smoke',
'a02n': 'smoke+night',
'a03d': 'hazy',
'a03n': 'hazy+night',
'a04d': 'sandstorm',
'a04n': 'sandstorm+night',
'a05d': 'foggy',
'a05n': 'foggy+night',
'a06d': 'foggy',
'a06n': 'foggy+night',
'c01d': 'upbeat',
'c01n': 'upbeat+night',
'c02d': 'happy',
'c02n': 'happy+night',
'c03d': 'carefree',
'c03n': 'carefree+night',
'c04d': 'overcast',
'c04n': 'overcast+night',
'u00d': 'rainy+tacos',
'u00n': 'rainy+tacos+night'
};
const searchTerm = dict[weather.data[0].weather.icon];
return searchTerm;
}
function chosenWeatherTranslator(weather) {
const dict = {
'sunny': 'upbeat',
'cloudy': 'overcast',
'thunder': 'angry',
'rain': 'mellow',
'freezing-rain': 'quiet',
'snow': 'dreamy',
'hazy': 'hazy'
};
const searchTerm = dict[weather];
return searchTerm;
}
module.exports = {
chosenWeatherTranslator, weatherTranslator
};