CEC-3595-invalid-locations (#276)

* CEC-3595-invalid-locations

* fix ci

* added validate function

* resolve comments:
This commit is contained in:
das31
2023-02-03 20:11:00 -05:00
committed by GitHub
parent 25cbafabce
commit f863f37a9a
3 changed files with 28 additions and 1 deletions

22
src/utils/locations.js Normal file
View File

@@ -0,0 +1,22 @@
export const ValidateLocationData = (location) => {
if (Math.abs(location.latitude) > 90 || Math.abs(location.longitude) > 180) {
return false;
}
if (location.altitude === 1401) {
return false;
}
return true;
}
export const ValidateLocationByParam = (parameter, value) => {
switch (parameter) {
case "latitude":
return Math.abs(value) <= 90;
case "longitude":
return Math.abs(value) <= 180;
case "altitude":
return value !== 1401;
default:
return false;
}
}