<commit_before>/**
@Author: <NAME> of http://paul.estrip.org
@Package: surebert 
*/

var sb = {

	/**
	@Name: sb.base
	@Description: Used Internally to find required files
	*/
	base : (typeof window.sbBase !='undefined') ? window.sbBase : '/surebert',

	/**
	@Name: sb.colors
	@Description: Used Internally. Methods used to calculate and manipulate color values, see also /colors direcory
	*/
	colors : {},

	/**
	@Name: sb.consol
	@Description: Used Internally.  Used as placeholder for sb.developer functions
	*/
	consol : {
		log : function(){},
		write : function(){},
		error : function(){}
	},

	/**
	@Name: sb.css
	@Description: Used Internally.  Used as placeholder for sb.css functions
	*/
	css : {},

	/**
	@Name: sb.included
	@Description:  An array of all modules that are included, updated live and can be used for debugging and making compressed libraries before putting into production
	@Example:
	alert(sb.included);
	*/
	included : [],
	/**
	@Name: sb.include
	@Description:  Includes another surebert module.  Make sure you surebert files are in /surebert or that you have set sb.base before using this.
	@Param: module You can include multiple modules by separating with a comma
	@Example:
	sb.include('String.prototype.nl2br');
	//or multiple modules
	sb.include('cookies,date');
	*/
	include : function(module, onload){
		onload = typeof onload == 'function' ? onload : function(){};
		
		if(module.match(',')){
			var modules = module.split(',');
			modules.forEach(function(v){
				sb.include(v);
			});

			return true;
		}

		var mods = module.split('.');
		var path ='', file, unit=sb,m;
		if(mods[0] == 'String' || mods[0] == 'Element' || mods[0] == 'Array'){
			unit = window;
		}

		for(m=0;m<mods.length;m++){

			if(m !==0 && m < mods.length && mods.length >1){
				path +='.';
			}
			path +=mods[m];
			
			try{

				unit = unit[mods[m]];

			} catch(e){}

			if(typeof unit == 'undefined'){
				
				this.included.push(path);
				if(sb.base == '/surebert'){
					file = sb.base+'/'+path.replace(/\./g, "/");
				} else {
					file = sb.base+path;
				}
				
				if(sb.base.match(/^http/)){
					var s = new sb.script({
						src : file
					});
					
					if(path == module){

						s.onload = onload;
					}

					s.load();
				} else {
					sb.load(file);
					if(path == module){
						onload();
					}
				}
				

			}
		}
	},
<commit_msg>onload parameter passed to sb.include is immediately fired if module is already loaded<commit_after>/**
@Author: <NAME> of http://paul.estrip.org
@Package: surebert 
*/

var sb = {

	/**
	@Name: sb.base
	@Description: Used Internally to find required files
	*/
	base : (typeof window.sbBase !='undefined') ? window.sbBase : '/surebert',

	/**
	@Name: sb.colors
	@Description: Used Internally. Methods used to calculate and manipulate color values, see also /colors direcory
	*/
	colors : {},

	/**
	@Name: sb.consol
	@Description: Used Internally.  Used as placeholder for sb.developer functions
	*/
	consol : {
		log : function(){},
		write : function(){},
		error : function(){}
	},

	/**
	@Name: sb.css
	@Description: Used Internally.  Used as placeholder for sb.css functions
	*/
	css : {},

	/**
	@Name: sb.included
	@Description:  An array of all modules that are included, updated live and can be used for debugging and making compressed libraries before putting into production
	@Example:
	alert(sb.included);
	*/
	included : [],
	/**
	@Name: sb.include
	@Description:  Includes another surebert module.  Make sure you surebert files are in /surebert or that you have set sb.base before using this.
	@Param: module You can include multiple modules by separating with a comma
	@Example:
	sb.include('String.prototype.nl2br');
	//or multiple modules
	sb.include('cookies,date');
	*/
	include : function(module, onload){
		onload = typeof onload == 'function' ? onload : function(){};
		
		if(module.match(',')){
			var modules = module.split(',');
			modules.forEach(function(v){
				sb.include(v);
			});

			return true;
		}

		var mods = module.split('.');
		var path ='', file, unit=sb,m;
		if(mods[0] == 'String' || mods[0] == 'Element' || mods[0] == 'Array'){
			unit = window;
		}

		for(m=0;m<mods.length;m++){

			if(m !==0 && m < mods.length && mods.length >1){
				path +='.';
			}
			path +=mods[m];
			
			try{

				unit = unit[mods[m]];

			} catch(e){}

			if(typeof unit == 'undefined'){
				
				this.included.push(path);
				if(sb.base == '/surebert'){
					file = sb.base+'/'+path.replace(/\./g, "/");
				} else {
					file = sb.base+path;
				}
				
				if(sb.base.match(/^http/)){
					var s = new sb.script({
						src : file
					});
					
					if(path == module){

						s.onload = onload;
					}

					s.load();
				} else {
					sb.load(file);
					if(path == module){
						onload();
					}
				}
				

			} else if(path == module){
				onload();
			}
		}
	},

{'fraction_non_alphanumeric': 0.1687538493122562, 'fraction_numerical': 0.0028741531513036336, 'mean_word_length': 2.8092259577795153, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '6278974', 'n_tokens_mistral': 1994, 'n_tokens_neox': 1654, 'n_words': 452}