1
0
CompleteNodeJS/notes-app/node_modules/validator/lib/isLatLong.js
Jason Williams 6528d7204a Section 20
2019-08-11 12:15:16 -06:00

23 lines
648 B
JavaScript

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (str) {
(0, _assertString2.default)(str);
if (!str.includes(',')) return false;
var pair = str.split(',');
return lat.test(pair[0]) && long.test(pair[1]);
};
var _assertString = require('./util/assertString');
var _assertString2 = _interopRequireDefault(_assertString);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/;
var long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/;
module.exports = exports['default'];