-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeo.js
18 lines (16 loc) · 1.14 KB
/
geo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export default function geoLocation() {
const countries = ['United States', 'Great Britain', 'Russia', 'Ukraine', 'Israel', 'India', 'China', 'Turkey'];
const regions = {
'United States': ['Arizona', 'California', 'Idaho', 'Oregon', 'Utah', 'Washington'],
'Great Britain': ['England', 'Northern Ireland', 'Scotland', 'Wales'],
'Russia': ['Adygea', 'Altai Republic', 'Bashkortostan', 'Buryatia', 'Dagestan'],
'Ukraine': ['Autonomous Republic of Crimea','Cherkasy Region', 'Kharkiv Region', 'Kyiv Region', 'Sumy Region'],
'Israel': ['Jerusalem District', 'Northern District', 'Haifa District', 'Tel Aviv District', 'Judea and Samaria'],
'India': ['Ajmer-Merwara', 'Assam', 'Baluchistan', 'Bengal', 'Bihar', 'Bombay'],
'China': ['Beijing Municipality', 'Tianjin Municipality', 'Jilin Province', 'Shanghai Municipality', 'Jiangsu Province'],
'Turkey': ['Adana', 'Ankara', 'Balıkesir', 'Bursa', 'Edirne', 'Istanbul', 'Ordu', 'Batman']
};
const country = countries[Math.floor(Math.random() * countries.length)];
const region = regions[country][Math.floor(Math.random() * Object.keys(regions).length)];
return { country, region };
}