<commit_before>
"use strict";

// deps
	
const 	fs = require('simplefs'),
		path = require('path');

// module

module.exports = class SimplePlugin {

	constructor () {

		this.directory = '';

		this.name = '';
		this.description = '';
		this.version = '';
		this.author = '';
		this.license = '';

		this.widget = '';

		this.templates = [];
		this.javascripts = [];

	}

	loadDataFromPackageFile () {

		if ('' == this.directory) {
			throw this.constructor.name + "/loadDataFromPackageFile : 'directory' is not defined.";
		}
		else if (!fs.dirExists(this.directory)) {
			throw this.constructor.name + "/loadDataFromPackageFile : '" + this.directory + "' does not exist.";
		}
		else {

			var file = path.join(this.directory, 'package.json');

			if (!fs.fileExists(file)) {
				throw this.constructor.name + "/loadDataFromPackageFile : '" + file + "' does not exist.";
			}
			else {

				var data = JSON.parse(fs.readFileSync(file, 'utf8'));

				if (data.name) {
					this.name = data.name;
				}
				if (data.description) {
					this.description = data.description;
				}
				if (data.version) {
					this.version = data.version;
				}
				if (data.author) {
					this.author = data.author;
				}
				if (data.license) {
					this.license = data.license;
				}

				if (data.widget) {

					data.widget = path.join(this.directory, data.widget);

					if (fs.fileExists(data.widget)) {
						this.widget = data.widget;
					}

				}<commit_msg>correction<commit_after>
"use strict";

// deps
	
const 	fs = require('simplefs'),
		path = require('path');

// module

module.exports = class SimplePlugin {

	constructor () {

		this.directory = '';

		this.name = '';
		this.description = '';
		this.version = '';
		this.author = '';
		this.license = '';
		this.github = '';

		this.widget = '';

		this.templates = [];
		this.javascripts = [];

	}

	loadDataFromPackageFile () {

		if ('' == this.directory) {
			throw this.constructor.name + "/loadDataFromPackageFile : 'directory' is not defined.";
		}
		else if (!fs.dirExists(this.directory)) {
			throw this.constructor.name + "/loadDataFromPackageFile : '" + this.directory + "' does not exist.";
		}
		else {

			var file = path.join(this.directory, 'package.json');

			if (!fs.fileExists(file)) {
				throw this.constructor.name + "/loadDataFromPackageFile : '" + file + "' does not exist.";
			}
			else {

				var data = JSON.parse(fs.readFileSync(file, 'utf8'));

				if (data.name) {
					this.name = data.name;
				}
				if (data.description) {
					this.description = data.description;
				}
				if (data.version) {
					this.version = data.version;
				}
				if (data.author) {
					this.author = data.author;
				}
				if (data.license) {
					this.license = data.license;
				}
				if (data.github) {
					this.github = data.github;
				}

				if (data.widget) {

					data.widget = path.join(this.directory, data.widget);

					if (fs.fileExists(data.widget)) {
						this.widget = data.widget;
					}

				}
{'fraction_non_alphanumeric': 0.1648793565683646, 'fraction_numerical': 0.0006702412868632708, 'mean_word_length': 2.5877403846153846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3549325', 'n_tokens_mistral': 1226, 'n_tokens_neox': 967, 'n_words': 187}