File tree 2 files changed +10
-9
lines changed
2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -33,3 +33,4 @@ yarn-error.log*
33
33
34
34
# vercel
35
35
.vercel
36
+ .idea
Original file line number Diff line number Diff line change @@ -8,31 +8,31 @@ export default (req, res) => {
8
8
9
9
const citiesCoords = {
10
10
mumbai : {
11
- lat : 20 ,
12
- lon : 78
11
+ lat : 19 ,
12
+ lon : 72
13
13
} ,
14
14
london : {
15
- lat : 55 ,
16
- lon : - 3
15
+ lat : 51 ,
16
+ lon : 0
17
17
} ,
18
18
"san francisco" : {
19
19
lat : 37 ,
20
- lon : - 95
20
+ lon : - 122
21
21
} ,
22
22
singapore : {
23
23
lat : 1 ,
24
24
lon : 103
25
25
} ,
26
26
sydney : {
27
- lat : - 31 ,
28
- lon : 115
27
+ lat : - 33 ,
28
+ lon : 151
29
29
}
30
30
}
31
31
const citiesKeys = Object . keys ( citiesCoords ) ;
32
32
citiesKeys . forEach ( ( cityName ) => {
33
33
const cityCoords = citiesCoords [ cityName ] ;
34
- const hasMatchingLat = latitude >= cityCoords . lat - 3 || latitude <= cityCoords . lat + 3 ;
35
- const hasMatchingLon = longitude >= cityCoords . lon - 3 || longitude <= cityCoords . lon + 3 ;
34
+ const hasMatchingLat = latitude >= cityCoords . lat - 3 && latitude <= cityCoords . lat + 3 ;
35
+ const hasMatchingLon = longitude >= cityCoords . lon - 3 && longitude <= cityCoords . lon + 3 ;
36
36
if ( hasMatchingLat && hasMatchingLon ) {
37
37
city = cityName ;
38
38
}
You can’t perform that action at this time.
0 commit comments