/**
* Module to use google's geocoding & reverse geocoding.
*/
let Geocoder;
export default Geocoder = {
apiKey : null,
options : {},
/**
* Initialize the module.
* @param {String} apiKey The api key of your application in google.
* @param {Object} [options] extra options for your geocoding request.
* @see https://developers.google.com/maps/documentation/geocoding/intro#geocoding
*/
init(apiKey, options = {}) {
this.apiKey = apiKey;
this.options = options;
},
/**
* @returns {boolean} True if the module has been initiated. False otherwise.
*/
get isInit() {
return !!this.apiKey;
},
/**
* Do (reverse) geocoding, converting geographic coordinates into a human-readable address & vice-versa.
* Accepted parameters:
*
* - from(Number latitude, Number longitude)
* - from(Array [latitude, longitude])
* - from(Object {latitude, longitude})
* - from(Object {lat, lng})
* - from(String address)
*
* @returns {Promise.