<commit_before>const movieRequest = require('./movieRequest')
const dreamRequest = require('./dreamRequest')

module.exports = caseHandler


function caseHandler(string) {

  const text = string.toLowerCase()
  const words = string.split(' ')
  const firstWord = words[0]
  words.splice(0, 1)
  var restWords = words.join(' ')


  return new Promise (function (resolve, reject) {
    switch(firstWord) {
      case "dream":
        dreamRequest(restWords)
          .then(function(result) {
            resolve(result)
          })
        break;
      case "movie":
        movieCase(restWords)
          .then(function(result) {
            resolve(result)
          })
        break;

      default:
        resolve(textCase(text))
    }
  })

}

function movieCase(restWords) {
  return new Promise (function (resolve, reject) {
    movieRequest(restWords)
      .then(function(result) {
        console.log("got result " , result)
        console.log("type: ", typeof result)
        if (result === undefined) reject(result)
        resolve(result)
      })
    })
}

function textCase(text) {
  switch (text) {
    case "hello":
      return "hello, friend";
    case "how are you?":
      return "I am swell, friend";
    case "what is your favourite movie?":
      return "Bee Movie, starring <NAME>, friend"
    default:
      return "Sorry, I didn't get that";
  }
}
<commit_msg>commented out dream case for heroku<commit_after>const movieRequest = require('./movieRequest')
const dreamRequest = require('./dreamRequest')

module.exports = caseHandler


function caseHandler(string) {

  const text = string.toLowerCase()
  const words = string.split(' ')
  const firstWord = words[0]
  words.splice(0, 1)
  var restWords = words.join(' ')


  return new Promise (function (resolve, reject) {
    switch(firstWord) {
      // case "dream":
      //   dreamRequest(restWords)
      //     .then(function(result) {
      //       resolve(result)
      //     })
      //   break;
      case "movie":
        movieCase(restWords)
          .then(function(result) {
            resolve(result)
          })
        break;

      default:
        resolve(textCase(text))
    }
  })

}

function movieCase(restWords) {
  return new Promise (function (resolve, reject) {
    movieRequest(restWords)
      .then(function(result) {
        console.log("got result " , result)
        console.log("type: ", typeof result)
        if (result === undefined) reject(result)
        resolve(result)
      })
    })
}

function textCase(text) {
  switch (text) {
    case "hello":
      return "hello, friend";
    case "how are you?":
      return "I am swell, friend";
    case "what is your favourite movie?":
      return "Bee Movie, starring <NAME>, friend"
    default:
      return "Sorry, I didn't get that";
  }
}

{'fraction_non_alphanumeric': 0.12176870748299319, 'fraction_numerical': 0.0020408163265306124, 'mean_word_length': 2.0957894736842104, 'pattern_counts': {'":': 10, '<': 5, '<?xml version=': 0, '>': 5, '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': '3895634', 'n_tokens_mistral': 895, 'n_tokens_neox': 829, 'n_words': 211}