google-map-react
Version:
isomorphic google map react component, allows render react components on the google map
43 lines (31 loc) • 897 B
JavaScript
;
exports.__esModule = true;
var _wrap2 = require('./wrap');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var LatLng = function () {
function LatLng(lat, lng) {
_classCallCheck(this, LatLng);
if (isNaN(lat) || isNaN(lng)) {
throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')');
}
this.lat = +lat;
this.lng = +lng;
}
LatLng.prototype.wrap = function wrap() {
return new LatLng(this.lat, (0, _wrap2.wrap)(this.lng, -180, 180));
};
return LatLng;
}();
LatLng.convert = function (a) {
if (a instanceof LatLng) {
return a;
}
if (Array.isArray(a)) {
return new LatLng(a[0], a[1]);
}
if ('lng' in a && 'lat' in a) {
return new LatLng(a.lat, a.lng);
}
return a;
};
exports.default = LatLng;