<commit_before>//This file contains the code to generate a dictionary
var request = require('request'),
         fs = require('fs'),
         jsonfile = require('jsonfile');

/* 
  API URL that filters all words with
  - difficulty levels 1 and 2 
  - minimum length of 4 letters
  - maximum length of 8 letters 

*/
var url = 'http://linkedin-reach.hagbpyjegb.us-west-2.elasticbeanstalk.com/words?difficulty=1|difficulty=1&minLength=4&maxLength=8';

//** TO DO  save dictionary
request(url, function(error, response, body){
  if(error){
    throw error;
  }else{
    if(response.statusCode === 200){
      
      //Save the dictionary words to an array
      var obj =  {words: body.split('\n')} ;
      

      //Save the words in a file called dictionaryWords.js to be used for game play
      var file = './client/dictionaryWords.json';

      jsonfile.writeFile(file, obj, function(error) {
        console.dir(error);
      })
      // fs.writeFile(file, words, (error) => {
      //   if (error) throw error;
      //   console.log('Words are saved to Dictionary file!');
      // });
    
    }
  }
});


<commit_msg>cleaned up code styling in createDictionary<commit_after>//This file contains the code to generate a dictionary
var request = require('request'),
    jsonfile = require('jsonfile');

/* 
  API URL that filters all words with
  - difficulty levels 1 and 2 
  - minimum length of 4 letters
  - maximum length of 8 letters 

*/
var url = 'http://linkedin-reach.hagbpyjegb.us-west-2.elasticbeanstalk.com/words?difficulty=1|difficulty=1&minLength=4&maxLength=8';

//** TO DO  save dictionary
request(url, function(error, response, body){
  if(error){
    throw error;
  }else{
    if(response.statusCode === 200){
      
      //Save the dictionary words to an array
      var obj =  {words: body.split('\n')} ;
      
      //Save the words in a json file called dictionaryWords.js to be used for game play
      var file = './client/dictionaryWords.json';

      jsonfile.writeFile(file, obj, function(error) {
        if(error) throw error;
      })
      
    }
  }
});



{'fraction_non_alphanumeric': 0.12452290076335878, 'fraction_numerical': 0.011450381679389313, 'mean_word_length': 2.704946996466431, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7616584', 'n_tokens_mistral': 671, 'n_tokens_neox': 630, 'n_words': 193}