<commit_before>module.exports = function() {
	var c = function() {}, public = c.prototype;
	
	/* Properties
	-------------------------------*/
	var _cache = {};
	
	/* Loader
	-------------------------------*/
	public.__load = c.load = function() {
		if(!this.__instance) {
			this.__instance = new c();
		}
		
		if(arguments.length == 0) {
			return this.__instance;
		}
		
		var edenized = this.__instance.edenize(arguments[0]);
		
		if(edenized) {
			return edenized;
		}
		
		return this.__instance.load.apply(this.__instance, arguments);
	};
	
	/* Construct
	-------------------------------*/
	/* Utility Methods
	-------------------------------*/
	/**
	 * No operation
	 *
	 * @return void
	 */
	public.noop = function() {};
	
	/**
	 * Alters a function to bind 
	 * a scope and add extra arguments
	 *
	 * @param function*
	 * @param object* scope
	 * @param [mixed[,mixed..]]
	 * @return function
	 */
	public.alter = function(callback, scope) {
		//get arguments
		var self = this, args = this.args();
		
		//take the callback and the scope
		//out of the arguments
		callback 	= args.shift(),
		scope 		= args.shift();
		
		//we are returning a function
		return function() {
			//get the active arguments
			var i, original = self.args();
			
			//add the extra arguments to the
			//original list of arguments
			for(i = 0; i < args.length; i++) {
				original.push(args[i]);
			}
			
			//now call the intended function with bounded arguments
			return callback.apply(scope || this, original);
		};
	};
	
	/**
	 * Returns an array form of arguments
	 *
	 * @return array
	 */
	public.args = function() {
		return Array.prototype.slice.apply(arguments.callee.caller.arguments);
	};
	
	/**
	 * All edens have load methods
	 *
	 * @param mixed
	 * @return bool 
	 */
	public.isEden = function(value) {
		return value && typeof value.__load == 'function';
	};
	
	/**
	 * Attemps to edenize a value
	 * false will be returned if fail
	 *
	 * @param mixed
	 * @param array
	 * @return mixed
	 */
	public.edenize = function(value, types) {
		var i, type;
		types = types || [];
		
		//if it's any type of eden
		if(this.isEden(value)) {
			// and there's no type
			// or there's a getType
			// and type is in the valid type
			if(types.length === 0 
			|| (typeof value.getType == 'function'
			&& types.indexOf(value.getType()) !== -1)) {
				//return it
				return value;
			}
			
			return false;
		}
		
		//if array is a valid type
		if(types.length === 0 || types.indexOf('array') !== -1) {
			type = this.get('array');
			//if value is an array
			if(type.isArray(value)) {
				//edenize it
				return type.load(arguments[0]);
			}
		}
		
		//if hash is a valid type
		if(types.length === 0 || types.indexOf('hash') !== -1) {
			type = this.get('hash');
			//if value is an array
			if(type.isHash(value)) {
				//edenize it
				return type.load(arguments[0]);
			}
		}
		
		//we failed :(
		return false;
	};
	
	/* Class Methods
	-------------------------------*/
	/**
	 * Loads a file and calls it passing arguments
	 *
	 * @param [mixed[,mixed..]]
	 * @return object
	 */
	public.load = function() {
		//get arguments
		var args = this.args();
		
		//remove the key from the arguments
		var key = args.shift();
		
		var definition = this.get(key);
		
		//if there is a loader
		if(typeof definition.load == 'function') {
			//call that loader
			return definition.load.apply(definition, args);
		}
		
		//call that function
		return definition.apply(definition, args);<commit_msg>related to 66aa296<commit_after>module.exports = function() {
	var c = function() {}, public = c.prototype;
	
	/* Properties
	-------------------------------*/
	var _cache = {};
	
	/* Loader
	-------------------------------*/
	public.__load = c.load = function() {
		if(!this.__instance) {
			this.__instance = new c();
		}
		
		if(arguments.length == 0) {
			return this.__instance;
		}
		
		var edenized = this.__instance.edenize(arguments[0]);
		
		if(edenized) {
			return edenized;
		}
		
		return this.__instance.load.apply(this.__instance, arguments);
	};
	
	/* Construct
	-------------------------------*/
	/* Utility Methods
	-------------------------------*/
	/**
	 * No operation
	 *
	 * @return void
	 */
	public.noop = function() {};
	
	/**
	 * Alters a function to bind 
	 * a scope and add extra arguments
	 *
	 * @param function*
	 * @param object* scope
	 * @param [mixed[,mixed..]]
	 * @return function
	 */
	public.alter = function(callback, scope) {
		//get arguments
		var self = this, args = this.args();
		
		//take the callback and the scope
		//out of the arguments
		callback 	= args.shift(),
		scope 		= args.shift();
		
		//we are returning a function
		return function() {
			//get the active arguments
			var i, original = self.args();
			
			//add the extra arguments to the
			//original list of arguments
			for(i = 0; i < args.length; i++) {
				original.push(args[i]);
			}
			
			//now call the intended function with bounded arguments
			return callback.apply(scope || this, original);
		};
	};
	
	/**
	 * Returns an array form of arguments
	 *
	 * @return array
	 */
	public.args = function() {
		return Array.prototype.slice.apply(arguments.callee.caller.arguments);
	};
	
	/**
	 * All edens have load methods
	 *
	 * @param mixed
	 * @return bool 
	 */
	public.isEden = function(value) {
		return value && typeof value.__load == 'function';
	};
	
	/**
	 * Attemps to edenize a value
	 * false will be returned if fail
	 *
	 * @param mixed
	 * @param array
	 * @return mixed
	 */
	public.edenize = function(value, types) {
		var i, type;
		types = types || [];
		
		//if it's any type of eden
		if(this.isEden(value)) {
			// and there's no type
			// or there's a getType
			// and type is in the valid type
			if(types.length === 0 
			|| (typeof value.getType == 'function'
			&& types.indexOf(value.getType()) !== -1)) {
				//return it
				return value;
			}
			
			return false;
		}
		
		//if array is a valid type
		if(types.length === 0 || types.indexOf('array') !== -1) {
			type = this.get('array');
			//if value is an array
			if(type.isArray(value)) {
				//edenize it
				return type.load(arguments[0]);
			}
		}
		
		//if hash is a valid type
		if(types.length === 0 || types.indexOf('hash') !== -1) {
			type = this.get('hash');
			//if value is an array
			if(type.isHash(value)) {
				//edenize it
				return type.load(arguments[0]);
			}
		}
		
		//if string is a valid type
		if(types.length === 0 || types.indexOf('string') !== -1) {
			type = this.get('string');
			//if value is an array
			if(type.isString(value)) {
				//edenize it
				return type.load(arguments[0]);
			}
		}
		
		//if number is a valid type
		if(types.length === 0 || types.indexOf('number') !== -1) {
			type = this.get('number');
			//if value is an array
			if(type.isNumber(value)) {
				//edenize it
				return type.load(arguments[0]);
			}
		}
		
		
		//we failed :(
		return false;
	};
	
	/* Class Methods
	-------------------------------*/
	/**
	 * Loads a file and calls it passing arguments
	 *
	 * @param [mixed[,mixed..]]
	 * @return object
	 */
	public.load = function() {
		//get arguments
		var args = this.args();
		
		//remove the key from the arguments
		var key = args.shift();
		
		var definition = this.get(key);
		
		//if there is a loader
		if(typeof definition.load == 'function') {
			//call that loader
			return definition.load.apply(definition, args);
		}
		
		//call that function
		return definition.apply(definition, args);
{'fraction_non_alphanumeric': 0.18786745056119722, 'fraction_numerical': 0.0044094067343666485, 'mean_word_length': 2.15290648694187, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1941745', 'n_tokens_mistral': 2814, 'n_tokens_neox': 2297, 'n_words': 677}