-
Notifications
You must be signed in to change notification settings - Fork 30
/
get-user-location.js
63 lines (59 loc) · 1.12 KB
/
get-user-location.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
const locations = [{
latitude: -3.723481,
longitude: -38.519582,
}, {
latitude: -3.747423,
longitude: -38.463484,
}, {
latitude: -3.768328,
longitude: -38.551830,
}, {
latitude: -3.785387,
longitude: -38.573802,
}, {
latitude: -3.817512,
longitude: -38.574977,
}, {
latitude: -3.820337,
longitude: -38.481324,
}, {
latitude: -3.823885,
longitude: -38.547935,
}, {
latitude: -3.741800,
longitude: -38.566323,
}, {
latitude: -3.712222,
longitude: -38.572331,
}, {
latitude: -3.802650,
longitude: -38.507777
}, {
latitude: -3.748046,
longitude: -38.502184,
}, {
latitude: -3.732947,
longitude: -38.497029
}, {
latitude: -3.765245,
longitude: -38.487598,
}, {
latitude: -3.744699,
longitude: -38.495637,
}, {
latitude: -3.732436,
longitude: -38.509978,
}, {
latitude: -3.728820,
longitude: -38.521255,
}, {
latitude: -3.747471,
longitude: -38.516713,
}];
const getUserLocation = () => {
const MIN = 0;
const MAX = locations.length - 1;
const randomIndex = Math.floor(Math.random() * (MAX - MIN + 1)) + MIN;
return locations[randomIndex];
};
module.exports = getUserLocation;