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

// ---

var helpers = require(path.join(__dirname, 'helpers.js'));

// ---

var VirtualBox = require(path.join(__dirname, 'virtualbox.js')).Provider;
var Amazon = require(path.join(__dirname, 'amazon.js')).Provider;

// ---

var instances = {};

// ---

function instance(name, manifest) {
	if (!instances.hasOwnProperty(name)) {
		if (exports.hasOwnProperty(name) && name != 'instance') {
			instances[name] = new exports[name](manifest);
			
			instances[name].name = name;
		} else {
			throw helpers.e('provider', helpers.q(name), 'is not found');
		}
	}
	
	return instances[name];
}

// ---

exports.VirtualBox = VirtualBox;
exports.Amazon = Amazon;
exports.instance = instance;<commit_msg>Refactored code for better readability.<commit_after>var path = require('path');

// ---

var helpers = require(path.join(__dirname, 'helpers.js'));

// ---

var VirtualBox = require(path.join(__dirname, 'virtualbox.js')).Provider;
var Amazon = require(path.join(__dirname, 'amazon.js')).Provider;

// ---

var instances = {};

// ---

function instance(name, manifest) {
	var niceName = name.toLowerCase();
	
	if (!instances.hasOwnProperty(niceName)) {
		if (exports.hasOwnProperty(niceName) && niceName != 'instance') {
			instances[niceName] = new exports[niceName](manifest);
			
			instances[niceName].name = niceName;
		} else {
			throw helpers.e('provider', helpers.q(name), 'is not found');
		}
	}
	
	return instances[niceName];
}

// ---

exports.virtualbox = VirtualBox;
exports.amazon = Amazon;

// ---

exports.VirtualBox = VirtualBox;
exports.Amazon = Amazon;
exports.instance = instance;
{'fraction_non_alphanumeric': 0.1797684338817794, 'fraction_numerical': 0.0, 'mean_word_length': 3.930930930930931, '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': '7082507', 'n_tokens_mistral': 551, 'n_tokens_neox': 527, 'n_words': 102}