Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_buildGeocoder() {
const lang = document.l10n.supportedLocales[0];
const bounds = this._radio.reqres.request('map:currentBounds');
const left = bounds._southWest.lng;
const top = bounds._northEast.lat;
const right = bounds._northEast.lng;
const bottom = bounds._southWest.lat;
const { lat, lng } = this._radio.reqres.request('map:currentCenter');
switch (this.model.get('geocoder')) {
case CONST.geocoder.nominatim:
return leafletControlGeocoder.nominatim({
geocodingQueryParams: {
viewbox: `${left},${top},${right},${bottom}`,
'accept-language': lang
}
});
default:
return leafletControlGeocoder.photon({
geocodingQueryParams: {
lat,
lon: lng,
lang
}
});
}
}
});