<commit_before>var convert = require('./convert');
var path = '/maps/api/geocode/json';

exports.inject = (makeApiCall) => ({

  geocode: (query, callback) => {
    if (query.components) {
      query.components = convert.components(query.components);
    }
    if (query.bounds) {
      query.bounds = convert.bounds(query.bounds);
    }
    return makeApiCall(path, query, callback);
  },

  reverseGeocode: (query, callback) => {
    if (!query.latlng) {
      throw 'latlong value required';
    } else {
      query.latlng = convert.latLng(query.latlng);
    }
    if (query.result_type) {
      query.result_type = convert.piped(query.result_type);
    }
    if (query.location_type) {
      query.location_type = convert.piped(query.location_type);
    }
    return makeApiCall(path, query, callback);
  }

});<commit_msg>Fix reverse geocode param validation<commit_after>var convert = require('./convert');
var path = '/maps/api/geocode/json';

exports.inject = (makeApiCall) => ({

  geocode: (query, callback) => {
    if (query.components) {
      query.components = convert.components(query.components);
    }
    if (query.bounds) {
      query.bounds = convert.bounds(query.bounds);
    }
    return makeApiCall(path, query, callback);
  },

  reverseGeocode: (query, callback) => {
    if (!query.latlng && !query.place_id) {
      throw 'latlong or place_id param required';
    }
    if (query.latlng) {
      query.latlng = convert.latLng(query.latlng);
    }
    if (query.result_type) {
      query.result_type = convert.piped(query.result_type);
    }
    if (query.location_type) {
      query.location_type = convert.piped(query.location_type);
    }
    return makeApiCall(path, query, callback);
  }

});
{'fraction_non_alphanumeric': 0.14632735685367265, 'fraction_numerical': 0.0, 'mean_word_length': 3.119047619047619, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1722785', 'n_tokens_mistral': 577, 'n_tokens_neox': 568, 'n_words': 102}