<commit_before>const yelp = require('yelp-fusion');
const ApiSecrets = require('./apisecrets.js');
const token = ApiSecrets.yelpToken;

let getRestaurantsFromYelp = function(userPref, callback) {
  const id = 1; //hardcoding id for 1st user
  const location = userPref[0].location ? userPref[0].location : 94105;
  const preferences = userPref[0].preferences ? userPref[0].preferences : 'italian, mexican';
  const client = yelp.client(token);
  
  client.search({
    location: location,
    term: preferences
  }).then(response => {
    let allResults = response.jsonBody.businesses;
    callback(null, allResults);
  }).catch(e => {
    callback(e, null);
  });
};

module.exports.getRestaurantsFromYelp = getRestaurantsFromYelp;<commit_msg>"commented out apisecrets and token for heroku deployment, added token ENV variable on heroku"<commit_after>const yelp = require('yelp-fusion');
// const ApiSecrets = require('./apisecrets.js');
// const token = ApiSecrets.yelpToken;

let getRestaurantsFromYelp = function(userPref, callback) {
  const id = 1; //hardcoding id for 1st user
  const location = userPref[0].location ? userPref[0].location : 94105;
  const preferences = userPref[0].preferences ? userPref[0].preferences : 'italian, mexican';
  const client = yelp.client(token);
  
  client.search({
    location: location,
    term: preferences
  }).then(response => {
    let allResults = response.jsonBody.businesses;
    callback(null, allResults);
  }).catch(e => {
    callback(e, null);
  });
};

module.exports.getRestaurantsFromYelp = getRestaurantsFromYelp;
{'fraction_non_alphanumeric': 0.13142857142857142, 'fraction_numerical': 0.013968253968253968, 'mean_word_length': 4.588652482269503, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1810955', 'n_tokens_mistral': 525, 'n_tokens_neox': 496, 'n_words': 114}