<commit_before>const Path = require('path');
const Fsep = require('fsep');
const Globals = require('../globals');

function Default (options) {
	const self = this;

	self.text = '';

	self.rel = options.rel;
	self.src = options.paths.src;
	self.abs = Path.join(options.paths.src, options.rel);
	self.dist = self.abs.replace('src', 'dist');

	var pathData = Globals.getPathData(self.abs);

	self.directory = pathData.directory;

	self.baseFull = pathData.baseFull;
	self.base = pathData.base;

	self.extensionFull = pathData.extensionFull;
	self.extension = pathData.extension;

	self.isBundle = self.base === 'bundle';

	self.options = options.options;

	return setup(self);
}

module.exports = Default;

function setup (self) {
	return setText(self).then(function () {

		return self;

	}).catch(function (error) { throw error; });
}

function setText (self) {
	return Fsep.readFile(self.abs, 'utf8').then(function (data) {

		self.text = data;

	}).catch(function (error) { throw error; });
}<commit_msg>added image condition<commit_after>const Path = require('path');
const Fsep = require('fsep');
const Globals = require('../globals');

function Default (options) {
	const self = this;

	self.text = '';

	self.rel = options.rel;
	self.src = options.paths.src;
	self.abs = Path.join(options.paths.src, options.rel);
	self.dist = self.abs.replace('src', 'dist');

	var pathData = Globals.getPathData(self.abs);

	self.directory = pathData.directory;

	self.baseFull = pathData.baseFull;
	self.base = pathData.base;

	self.extensionFull = pathData.extensionFull;
	self.extension = pathData.extension;

	self.isBundle = self.base === 'bundle';

	self.encoding = (self.extFull === 'jpg' || self.extFull === 'JPG' ||
				self.extFull === 'png' || self.extFull === 'PNG') ? 'binary' : 'utf8';
				//TODO: need to add more codtions

	self.options = options.options;

	return setup(self);
}

module.exports = Default;

function setup (self) {
	return setText(self).then(function () {

		return self;

	}).catch(function (error) { throw error; });
}

function setText (self) {
	return Fsep.readFile(self.abs, self.encoding).then(function (data) {

		self.text = data;

	}).catch(function (error) { throw error; });
}
{'fraction_non_alphanumeric': 0.16779737675260065, 'fraction_numerical': 0.0009045680687471732, 'mean_word_length': 4.266666666666667, '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': '4705296', 'n_tokens_mistral': 778, 'n_tokens_neox': 739, 'n_words': 163}