SB-6.1-PRE
This commit is contained in:
1 parent
690169a409
commit
358a25f522
3760 files changed
+300059
-36
No files matched your search
+10
@@ -0,0 +1,10 @@
|
||||
import assertString from './util/assertString';
|
||||
var lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/;
|
||||
var _long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/;
|
||||
export default function (str) {
|
||||
assertString(str);
|
||||
if (!str.includes(',')) return false;
|
||||
var pair = str.split(',');
|
||||
if (pair[0].startsWith('(') && !pair[1].endsWith(')') || pair[1].endsWith(')') && !pair[0].startsWith('(')) return false;
|
||||
return lat.test(pair[0]) && _long.test(pair[1]);
|
||||
}
|
||||
Reference in new issue
Block a user