Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function geocode(location, callback) {
var lonLat = [geolib.longitude(location), geolib.latitude(location)].join(',');
// Function for requesting a reversed geocode location if we have no cache entry
function requestApi() {
var apiURLObject = url.parse(config.mapbox.api_url, true),
path = ['geocode', config.mapbox.geocoding_index];
path.push(lonLat);
apiURLObject.pathname += '/' + path.join('/') + '.json';
apiURLObject.query.access_token = clientConfig.mapbox.token;
var options = {
url: url.format(apiURLObject),
gzip: true
};