lib/geo.js
function parseGoogleGeocodes(response) {
  // the result has a results property that is an array
  // there may be more than one result when the address is ambiguous
  // for pragmatic reasons, only use the first result
  // if the result does not have a zip code, then assume the user
  // did not provide a valid address

  var result = response.results[0]
    , zipComponent = findAddressComponent(result.address_components, 'postal_code')
    , simple = {}
    ;

  simple.zip5 = zipComponent ? zipComponent.short_name : null;
  simple.address = result.formatted_address.replace(/,\s*USA/, '');
  simple.localAddress = getLocalAddress(result) || simple.address;
  simple.location = result.geometry.location;
  return simple;
}
function parseGoogleGeocodes(response) {
  // the result has a results property that is an array
  // there may be more than one result when the address is ambiguous
  // for pragmatic reasons, only use the first result
  // if the result does not have a zip code, then assume the user
  // did not provide a valid address

  var result = response.results[0]
    , zipComponent = findAddressComponent(result.address_components, 'postal_code')
    , simple = {}
    ;

  simple.zip5 = zipComponent ? zipComponent.short_name : null;
  simple.address = result.formatted_address.replace(/,\s*USA/, '');
  simple.localAddress = getLocalAddress(result) || simple.address;
  simple.location = result.geometry.location;
  return simple;
}
function parseGoogleGeocodes ( response ) { // the result has a results property that is an array // there may be more than one result when the address is ambiguous // for pragmatic reasons, only use the first result // if the result does not have a zip code, then assume the user // did not provide a valid address var result = response . results [ 0 ] , zipComponent = findAddressComponent ( result . address_components , 'postal_code' ) , simple = { } ; simple . zip5 = zipComponent ? zipComponent . short_name : null ; simple . address = result . formatted_address . replace ( / ,\s*USA / , '' ) ; simple . localAddress = getLocalAddress ( result ) || simple . address ; simple . location = result . geometry . location ; return simple ; }
Parse the JSON result that Google returned
@param response an object with results parsed from the body of Google's API response
@return an object with zip5, address (formatted address),
and location (lat, lng) properties, or null if not a valid address
Parse the JSON result that Google returned