universal-geocoder
Version:
Universal geocoding abstraction server-side and client-side with multiple built-in providers
100 lines • 3.76 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var Geocoded = /** @class */ (function () {
function Geocoded(_a) {
var coordinates = _a.coordinates, bounds = _a.bounds, formattedAddress = _a.formattedAddress, streetNumber = _a.streetNumber, streetName = _a.streetName, subLocality = _a.subLocality, locality = _a.locality, postalCode = _a.postalCode, region = _a.region, adminLevels = _a.adminLevels, country = _a.country, countryCode = _a.countryCode, timezone = _a.timezone;
this.coordinates = coordinates;
this.bounds = bounds;
this.formattedAddress = formattedAddress;
this.streetNumber = streetNumber;
this.streetName = streetName;
this.subLocality = subLocality;
this.locality = locality;
this.postalCode = postalCode;
this.region = region;
this.adminLevels = adminLevels || [];
this.country = country;
this.countryCode = countryCode;
this.timezone = timezone;
}
Geocoded.create = function (object) {
return new this(object);
};
Geocoded.prototype.toObject = function () {
return {
coordinates: this.coordinates,
bounds: this.bounds,
formattedAddress: this.formattedAddress,
streetNumber: this.streetNumber,
streetName: this.streetName,
subLocality: this.subLocality,
locality: this.locality,
postalCode: this.postalCode,
region: this.region,
adminLevels: this.adminLevels,
country: this.country,
countryCode: this.countryCode,
timezone: this.timezone,
};
};
Geocoded.prototype.withBounds = function (bounds) {
return this.constructor.create(__assign(__assign({}, this.toObject()), { bounds: bounds }));
};
Geocoded.prototype.withCoordinates = function (coordinates) {
return this.constructor.create(__assign(__assign({}, this.toObject()), { coordinates: coordinates }));
};
Geocoded.prototype.getCoordinates = function () {
return this.coordinates;
};
Geocoded.prototype.getBounds = function () {
return this.bounds;
};
Geocoded.prototype.getFormattedAddress = function () {
return this.formattedAddress;
};
Geocoded.prototype.getStreetNumber = function () {
return this.streetNumber;
};
Geocoded.prototype.getStreetName = function () {
return this.streetName;
};
Geocoded.prototype.getSubLocality = function () {
return this.subLocality;
};
Geocoded.prototype.getLocality = function () {
return this.locality;
};
Geocoded.prototype.getPostalCode = function () {
return this.postalCode;
};
Geocoded.prototype.getRegion = function () {
return this.region;
};
Geocoded.prototype.addAdminLevel = function (adminLevel) {
this.adminLevels.push(adminLevel);
};
Geocoded.prototype.getAdminLevels = function () {
return this.adminLevels;
};
Geocoded.prototype.getCountry = function () {
return this.country;
};
Geocoded.prototype.getCountryCode = function () {
return this.countryCode;
};
Geocoded.prototype.getTimezone = function () {
return this.timezone;
};
return Geocoded;
}());
export default Geocoded;
//# sourceMappingURL=Geocoded.js.map