<commit_before>var path    = require('path');
var fs      = require('fs');

/**▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
 * @module componentExtractor
 * @desc   Extract require and generate component.json files of a project.
 *
 * @author <NAME>
 */


// load config.json
var config = fs.readFileSync(path.join(__dirname, 'config.json'), { encoding: 'utf8' });
if (!config) return console.warn('[ERROR] No config.json file.');
config = JSON.parse(config);

var sourcePaths = config.sourcePaths;
var excludePaths = config.excludePaths;
var externalDependencies = config.externalDependencies;

var sourcePathsLength = sourcePaths.length;
var componentList = {};<commit_msg>bugfix: throw error instead of illegal return statement<commit_after>var path    = require('path');
var fs      = require('fs');

/**▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
 * @module componentExtractor
 * @desc   Extract require and generate component.json files of a project.
 *
 * @author <NAME>
 */


// load config.json
var config = fs.readFileSync(path.join(__dirname, 'config.json'), { encoding: 'utf8' });
if (!config) throw new Error('[ERROR] No config.json file.');
config = JSON.parse(config);

var sourcePaths = config.sourcePaths;
var excludePaths = config.excludePaths;
var externalDependencies = config.externalDependencies;

var sourcePathsLength = sourcePaths.length;
var componentList = {};
{'fraction_non_alphanumeric': 0.24396782841823056, 'fraction_numerical': 0.0013404825737265416, 'mean_word_length': 5.725225225225225, 'pattern_counts': {'":': 0, '<': 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': '2662590', 'n_tokens_mistral': 563, 'n_tokens_neox': 748, 'n_words': 112}