@osimatic/helpers-js 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/location.js +10 -0
- package/package.json +1 -1
package/location.js
CHANGED
|
@@ -427,6 +427,16 @@ class GeographicCoordinates {
|
|
|
427
427
|
static check(str) {
|
|
428
428
|
return /^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/.test(str);
|
|
429
429
|
}
|
|
430
|
+
|
|
431
|
+
static parse(str) {
|
|
432
|
+
if (null === str || '' === str || 'NaN,NaN' === str) {
|
|
433
|
+
return null;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
return str.split(',').map(str => str.trim()).join(',');
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
|
|
430
440
|
}
|
|
431
441
|
|
|
432
442
|
module.exports = { Country, PostalAddress, GeographicCoordinates };
|