const request = require('request');

const geocodeAddress = (address, callback) => {

  var url = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(address)}`;

  request({
    url: url,
    json: true
  }, (error, response, body) => {
    if (error) {
      callback('Unable to connect to Google services.');
    } else if (body.status === 'ZERO_RESULTS') {
      callback('Unable to find address');
    } else if (body.status === 'OK'){
      callback({
        address: body.results[0].formatted_address,
        latitude: body.results[0].geometry.location.lat,
        longitude: body.results[0].geometry.location.lng
      });
    }
  });

}
module.exports = {
  geocodeAddress
};

const request = require('request');

const geocodeAddress = (address, callback) => {

  var url = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(address)}`;

  request({
    url: url,
    json: true
  }, (error, response, body) => {
    if (error) {
      callback('Unable to connect to Google services.');
    } else if (body.status === 'ZERO_RESULTS') {
      callback('Unable to find address');
    } else if (body.status === 'OK'){
      callback(undefined, {
        address: body.results[0].formatted_address,
        latitude: body.results[0].geometry.location.lat,
        longitude: body.results[0].geometry.location.lng
      });
    }
  });

}
module.exports = {
  geocodeAddress
};

Add undefined argument