<commit_before>



/*
* can mixin this type to aid validation
*/ 
function InterfaceType(body) {

	body.implements = function(implementation) {
	
		for(prop in body) {
		
			if(body.hasOwnProperty(prop) && prop !== 'implements') {
			
				if(!implementation.hasOwnProperty(prop) 
					|| typeof implementation[prop] != typeof body[prop]) {
					
					return false;
				}
			}
		}
		
		return true;
	};
	
	return body;
}



var HtmlEntities = {
	// smoothing over the setting of values
	asSetter : function(domEl) {
		
		var action;
		
		if(domEl.value) {
		
			action = function(val) {
			
				domEl.value = val;
			};
		} else {
		
			action = function(val) {
			
				domEl.innerHTML = val;
			};
		}
		
		return {
		
			set : function(val) {
			
				action(val);
			}
		};
	},
	
	asPosition : function(domEl) {
	
		return {
		
			set : function(val) {
			
				domEl.style.left = val + 'px';
			}
		};
	}


};


var Helpers = {

	asValidatedInput : function(elementName, validateAction) {
	
		return function() {
		
			var el = document.getElementById(elementName);
			
			el.validate = function() { return validateAction(el.value); }
			
			return el;
		};
	}
	
	

};
<commit_msg>refactored the HtmlElements object to be a bit more functional<commit_after>



/*
* can mixin this type to aid validation
*/ 
function InterfaceType(body) {

	body.implements = function(implementation) {
	
		for(prop in body) {
		
			if(body.hasOwnProperty(prop) && prop !== 'implements') {
			
				if(!implementation.hasOwnProperty(prop) 
					|| typeof implementation[prop] != typeof body[prop]) {
					
					return false;
				}
			}
		}
		
		return true;
	};
	
	return body;
}



var HtmlEntities = {

	_cache : [],

	as : function(domEl, action) {
	
		if(!HtmlEntities._cache[domEl]) { 
			
			HtmlEntities._cache[domEl] = {
			
				set : function(val) {
				
					action(val);
				}
			};		
		}
		
		return HtmlEntities._cache[domEl];
	},
	
	// smoothing over the setting of values
	asSetter : function(domEl) {
		
		return HtmlEntities.as(domEl, 
		
			domEl.value 
			
				? function(val) { domEl.value = val; } 
			
				:  function(val) { domEl.innerHTML = val; 
		});
	},
	
	asPosition : function(domEl) {
	
		return HtmlEntities.as(domEl, function(val) {
			
			domEl.style.left = val + 'px';
		});
	}
};


var Helpers = {

	asValidatedInput : function(elementName, validateAction) {
	
		return function() {
		
			var el = document.getElementById(elementName);
			
			el.validate = function() { return validateAction(el.value); }
			
			return el;
		};
	}
};

{'fraction_non_alphanumeric': 0.13166144200626959, 'fraction_numerical': 0.0, 'mean_word_length': 2.459349593495935, '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': '25074', 'n_tokens_mistral': 1118, 'n_tokens_neox': 854, 'n_words': 171}