This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
generated from gomu-gomu/starter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
453 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
{ | ||
"Afghanistan": "Afghanistan", | ||
"Albania": "Albania", | ||
"Algeria": "Algeria", | ||
"Andorra": "Andorra", | ||
"Angola": "Angola", | ||
"Anguilla": "Anguilla", | ||
"Antigua and Barbuda": "Antigua and Barbuda", | ||
"Argentina": "Argentina", | ||
"Armenia": "Armenia", | ||
"Aruba": "Aruba", | ||
"Australia": "Australia", | ||
"Austria": "Austria", | ||
"Azerbaijan": "Azerbaijan", | ||
"Bahamas": "Bahamas", | ||
"Bahrain": "Bahrain", | ||
"Bangladesh": "Bangladesh", | ||
"Barbados": "Barbados", | ||
"Belarus": "Belarus", | ||
"Belgium": "Belgium", | ||
"Belize": "Belize", | ||
"Benin": "Benin", | ||
"Bermuda": "Bermuda", | ||
"Bhutan": "Bhutan", | ||
"Bolivia": "Bolivia", | ||
"Bosnia": "Bosnia and Herzegovina", | ||
"Botswana": "Botswana", | ||
"Brazil": "Brazil", | ||
"British Virgin Islands": "British Virgin Islands", | ||
"Brunei": "Brunei", | ||
"Bulgaria": "Bulgaria", | ||
"Burkina Faso": "Burkina Faso", | ||
"Burundi": "Burundi", | ||
"Cambodia": "Cambodia", | ||
"Cameroon": "Cameroon", | ||
"Canada": "Canada", | ||
"Cabo Verde": "Cabo Verde", | ||
"Cayman Islands": "Cayman Islands", | ||
"Central African Republic": "Central African Republic", | ||
"Chad": "Chad", | ||
"Chile": "Chile", | ||
"China": "China", | ||
"Colombia": "Colombia", | ||
"Comoros": "Comoros", | ||
"Congo": "Congo", | ||
"Cook Islands": "Cook Islands", | ||
"Costa Rica": "Costa Rica", | ||
"Côte d'Ivoire": "Côte d'Ivoire", | ||
"Croatia": "Croatia", | ||
"Cuba": "Cuba", | ||
"Curaçao": "Curaçao", | ||
"Cyprus": "Cyprus", | ||
"Czechia": "Czechia", | ||
"DRC": "DRC", | ||
"Denmark": "Denmark", | ||
"Djibouti": "Djibouti", | ||
"Dominica": "Dominica", | ||
"Dominican Republic": "Dominican Republic", | ||
"Ecuador": "Ecuador", | ||
"Egypt": "Egypt", | ||
"El Salvador": "El Salvador", | ||
"Equatorial Guinea": "Equatorial Guinea", | ||
"Estonia": "Estonia", | ||
"eSwatini": "Swaziland", | ||
"Ethiopia": "Ethiopia", | ||
"Faeroe Is.": "Faroe Islands", | ||
"Falkland Is.": "Falkland Islands (Malvinas)", | ||
"Fiji": "Fiji", | ||
"Finland": "Finland", | ||
"France": "France", | ||
"Fr. Polynesia": "French Polynesia", | ||
"Gabon": "Gabon", | ||
"Gambia": "Gambia", | ||
"Georgia": "Georgia", | ||
"Germany": "Germany", | ||
"Ghana": "Ghana", | ||
"Gibraltar": "Gibraltar", | ||
"Greece": "Greece", | ||
"Greenland": "Greenland", | ||
"Grenada": "Grenada", | ||
"Guatemala": "Guatemala", | ||
"Guernsey": "Guernsey", | ||
"Guinea": "Guinea", | ||
"Guinea-Bissau": "Guinea-Bissau", | ||
"Guyana": "Guyana", | ||
"Haiti": "Haiti", | ||
"Honduras": "Honduras", | ||
"Hong Kong": "Hong Kong", | ||
"Hungary": "Hungary", | ||
"Iceland": "Iceland", | ||
"India": "India", | ||
"Indonesia": "Indonesia", | ||
"Iran": "Iran", | ||
"Iraq": "Iraq", | ||
"Ireland": "Ireland", | ||
"Isle of Man": "Isle of Man", | ||
"Israel": "Israel", | ||
"Italy": "Italy", | ||
"Jamaica": "Jamaica", | ||
"Japan": "Japan", | ||
"Jordan": "Jordan", | ||
"Kazakhstan": "Kazakhstan", | ||
"Kenya": "Kenya", | ||
"Kiribati": "Kiribati", | ||
"Kuwait": "Kuwait", | ||
"Kyrgyzstan": "Kyrgyzstan", | ||
"Laos": "Lao People's Democratic Republic", | ||
"Latvia": "Latvia", | ||
"Lebanon": "Lebanon", | ||
"Lesotho": "Lesotho", | ||
"Liberia": "Liberia", | ||
"Libya": "Libyan Arab Jamahiriya", | ||
"Liechtenstein": "Liechtenstein", | ||
"Lithuania": "Lithuania", | ||
"Luxembourg": "Luxembourg", | ||
"Macao": "Macao", | ||
"Madagascar": "Madagascar", | ||
"Malawi": "Malawi", | ||
"Malaysia": "Malaysia", | ||
"Maldives": "Maldives", | ||
"Mali": "Mali", | ||
"Malta": "Malta", | ||
"Mauritania": "Mauritania", | ||
"Mauritius": "Mauritius", | ||
"Mexico": "Mexico", | ||
"Moldova": "Moldova", | ||
"Monaco": "Monaco", | ||
"Mongolia": "Mongolia", | ||
"Montenegro": "Montenegro", | ||
"Montserrat": "Montserrat", | ||
"Morocco": "Morocco", | ||
"Mozambique": "Mozambique", | ||
"Myanmar": "Myanmar", | ||
"Namibia": "Namibia", | ||
"Nauru": "Nauru", | ||
"Nepal": "Nepal", | ||
"Netherlands": "Netherlands", | ||
"New Caledonia": "New Caledonia", | ||
"New Zealand": "New Zealand", | ||
"Nicaragua": "Nicaragua", | ||
"Niger": "Niger", | ||
"Nigeria": "Nigeria", | ||
"Niue": "Niue", | ||
"Macedonia": "Macedonia", | ||
"Norway": "Norway", | ||
"Oman": "Oman", | ||
"Pakistan": "Pakistan", | ||
"Palestine": "Palestine", | ||
"Panama": "Panama", | ||
"Papua New Guinea": "Papua New Guinea", | ||
"Paraguay": "Paraguay", | ||
"Peru": "Peru", | ||
"Philippines": "Philippines", | ||
"Pitcairn Is.": "Pitcairn", | ||
"Poland": "Poland", | ||
"Portugal": "Portugal", | ||
"Qatar": "Qatar", | ||
"Romania": "Romania", | ||
"Russia": "Russia", | ||
"Rwanda": "Rwanda", | ||
"Saint Helena": "Saint Helena", | ||
"St. Kitts and Nevis": "Saint Kitts and Nevis", | ||
"Saint Lucia": "Saint Lucia", | ||
"St. Vin. and Gren.": "Saint Vincent and the Grenadines", | ||
"Samoa": "Samoa", | ||
"San Marino": "San Marino", | ||
"São Tomé and Principe": "Sao Tome and Principe", | ||
"Saudi Arabia": "Saudi Arabia", | ||
"Senegal": "Senegal", | ||
"Serbia": "Serbia", | ||
"Seychelles": "Seychelles", | ||
"Sierra Leone": "Sierra Leone", | ||
"Singapore": "Singapore", | ||
"Sint Maarten": "Sint Maarten", | ||
"Slovakia": "Slovakia", | ||
"Slovenia": "Slovenia", | ||
"Solomon Is.": "Solomon Islands", | ||
"Somalia": "Somalia", | ||
"South Africa": "South Africa", | ||
"South Korea": "S. Korea", | ||
"S. Sudan": "South Sudan", | ||
"Spain": "Spain", | ||
"Sri Lanka": "Sri Lanka", | ||
"Sudan": "Sudan", | ||
"Suriname": "Suriname", | ||
"Sweden": "Sweden", | ||
"Switzerland": "Switzerland", | ||
"Syria": "Syrian Arab Republic", | ||
"Taiwan": "Taiwan", | ||
"Tajikistan": "Tajikistan", | ||
"Tanzania": "Tanzania", | ||
"Thailand": "Thailand", | ||
"Timor-Leste": "Timor-Leste", | ||
"Togo": "Togo", | ||
"Tokelau": "Tokelau", | ||
"Tonga": "Tonga", | ||
"Trinidad and Tobago": "Trinidad and Tobago", | ||
"Tunisia": "Tunisia", | ||
"Turkey": "Turkey", | ||
"Turkmenistan": "Turkmenistan", | ||
"Turks and Caicos Is.": "Turks and Caicos Islands", | ||
"Tuvalu": "Tuvalu", | ||
"Uganda": "Uganda", | ||
"Ukraine": "Ukraine", | ||
"United Arab Emirates": "UAE", | ||
"United Kingdom": "UK", | ||
"United States of America": "USA", | ||
"Uruguay": "Uruguay", | ||
"Uzbekistan": "Uzbekistan", | ||
"Vanuatu": "Vanuatu", | ||
"Venezuela": "Venezuela", | ||
"Vietnam": "Vietnam", | ||
"Wallis and Futuna": "Wallis and Futuna", | ||
"Yemen": "Yemen", | ||
"Zambia": "Zambia", | ||
"Zimbabwe": "Zimbabwe" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
export function getTotalData() { | ||
return new Promise(async resolve => { | ||
const data = await fetch('https://disease.sh/v3/covid-19/all') | ||
.then(e => e.json()) | ||
.then(e => ({ | ||
cases: e.cases, | ||
deaths: e.deaths, | ||
recovered: e.recovered | ||
})) | ||
|
||
resolve(data); | ||
}) | ||
} | ||
|
||
export function getHistoricalData() { | ||
return new Promise(resolve => { | ||
fetch('https://disease.sh/v3/covid-19/historical/all?lastdays=all') | ||
.then(e => e.json()) | ||
.then(data => { | ||
const keys = Object.keys(data); | ||
const result = keys.reduce((obj, key) => ({ | ||
...obj, | ||
[key]: Object | ||
.entries(data[key]) | ||
.map(e => [new Date(e[0]), e[1]]) | ||
.reduce((obj, e) => ({ | ||
...obj, | ||
[e[0].getFullYear()]: { | ||
...obj[e[0].getFullYear()], | ||
[e[0].getMonth() + 1]: e[1] | ||
} | ||
}), {}) | ||
}), {}); | ||
|
||
resolve(result); | ||
}); | ||
}) | ||
} | ||
|
||
export function getVaccinationData() { | ||
return new Promise(resolve => { | ||
fetch('https://disease.sh/v3/covid-19/vaccine/coverage/countries?lastdays=all') | ||
.then(e => e.json()) | ||
.then(data => { | ||
const result = data.map(country => ({ | ||
...country, | ||
timeline: Object | ||
.entries(country.timeline) | ||
.map(e => [new Date(e[0]), e[1]]) | ||
.reduce((obj, e) => ({ | ||
...obj, | ||
[e[0].getFullYear()]: { | ||
...obj[e[0].getFullYear()], | ||
[e[0].getMonth() + 1]: e[1] | ||
} | ||
}), {}) | ||
})); | ||
|
||
resolve(result); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.