<commit_before>Structr -  Structure for Javascript            
======================================== 
Structr is a framework that aims to:
                                               
* Lightweight.
* Provide as few new concepts as possible coming from OOP. Learning it should be easy.
* Help develop re-useable, clean, and consistent code.
* Be fun, and easy to work with.                                                 
* Reduce the amount of reduntant code.   
* Combine suplemented patterns used in Javascript in an easy to use form.        

Supports:        
                                             
* _super                                     
* inheritance      
* Implicit / Explicit getters & setters
* Override, and Static       
* metadata      
* mixing modifiers. e.g: 'explicit bindable name': function(){}          
	

Installation
------------

Node.js: 

	npm install structr
		   
		
Using Structr
-------------
 
	var Recipe = Structr({  
		
		'__construct': function(name)
		{
			this._name = name;
		},                
		
		'name': function()
		{
			return this._name;
		},
		
		'ingredients': function()
		{
			alert('This is going to be tasty...');
		}
	});                      

	var tiramisuRecipe = new Recipe('Tiramisu');   
	console.log(tiramisuRecipe.name()); //tiramisu


### Class.extend


	var TiramisuRecipe = Recipe.extend({

		'override __construct': function()
		{
			this._super('Tiramisu');
		},
		
		'override ingredients': function()
		{
			this._super();
			
			alert('Mascarpone, Heavy Cream, Eggs, Espresso, Sugar, Cocoa, Baileys, and Lady Fingers.');
		}
	});
	
	var PastaRecipe = Recipe.extend({
		
		'override __construct': function()
		{
			this._super('Pasta');
		},
		
		'override ingredients': function()
		{
			this._super();
			
			alert('Eggs, Flour, Water, Salt');
		}
	});
	
	var tiramisu = new TiramisuRecipe();
	var pasta = new PastaRecipe();
	
	tiramisu.ingredients();
	pasta.ingredients();

Properties
----------

### _super

References the parent class method if override is provided.

Modifiers
---------      
                      
### Overriding Methods

Methods overridden have access to the _super property.

	'override __construct': function()
	{
		this._super();
	}

### Overwriting Methods
   
Faster if you don't plan on using _super.

	'__construct': function()
	{
		//cannot access _super __construct
	}
    
### Static Keyword 

Properties, and methods set to the class versus objects instantiated.

	var Singleton = Structr({
		
		'static getInstance': function()
		{
			return this._instance || (this._instance = new Singleton());
		}
	});
	
	var test1 = Singleton.getInstance();
	var test2 = Singleton.getInstance();
	test2.name = 'Craig';<commit_msg>updated readme to include info on overloading methods<commit_after>Structr -  Structure for Javascript            
======================================== 
Structr is a framework that aims to:
                                               
* Lightweight.
* Provide as few new concepts as possible coming from OOP. Learning it should be easy.
* Help develop re-useable, clean, and consistent code.
* Be fun, and easy to work with.                                                 
* Reduce the amount of reduntant code.   
* Combine suplemented patterns used in Javascript in an easy to use form.        

Supports:        
                                             
* _super                                     
* inheritance      
* overloading methods
* Implicit / Explicit getters & setters
* Override, and Static       
* metadata      
* mixing modifiers. e.g: 'explicit bindable name': function(){}          
	

Installation
------------

Node.js: 

	npm install structr
		   
		
Using Structr
-------------
 
	var Recipe = Structr({  
		
		'__construct': function(name)
		{
			this._name = name;
		},                
		
		'name': function()
		{
			return this._name;
		},
		
		'ingredients': function()
		{
			alert('This is going to be tasty...');
		}
	});                      

	var tiramisuRecipe = new Recipe('Tiramisu');   
	console.log(tiramisuRecipe.name()); //tiramisu


### Class.extend


	var TiramisuRecipe = Recipe.extend({

		'override __construct': function()
		{
			this._super('Tiramisu');
		},
		
		'override ingredients': function()
		{
			this._super();
			
			alert('Mascarpone, Heavy Cream, Eggs, Espresso, Sugar, Cocoa, Baileys, and Lady Fingers.');
		}
	});
	
	var PastaRecipe = Recipe.extend({
		
		'override __construct': function()
		{
			this._super('Pasta');
		},
		
		'override ingredients': function()
		{
			this._super();
			
			alert('Eggs, Flour, Water, Salt');
		}
	});
	
	var tiramisu = new TiramisuRecipe();
	var pasta = new PastaRecipe();
	
	tiramisu.ingredients();
	pasta.ingredients();

Properties
----------

### _super

References the parent class method if override is provided.

Modifiers
---------      
                      
### Overriding Methods

Methods overridden have access to the _super property.

	'override __construct': function()
	{
		this._super();
	}

### Overwriting Methods
   
Faster if you don't plan on using _super.

	'__construct': function()
	{
		//cannot access _super __construct
	}
	
	
### Overloading Methods (Experimental)

Overloading methods allows you to write polymorphic functions which are mapped out depending on the number of parameters used. You must provide your own identifier (it could be anything) for each overloaded method, otherwise you'll simply be overwriting methods. 

	var Person = Structr({

		'sayHello': function(name, callback)
		{
			this._name = name;
			this.sayHello(callback);
		},

		'2 sayHello': function(callback)
		{
			callback(this.sayHello());
		},

		'3 sayHello': function()
		{
			return 'Hello '+this._name;
		}
	});

	var SubPerson = Person.extend({

		'override 1 sayHello': function(callback)
		{
			callback(this.sayHello()+' Do you like italian food?');
		},

		'override sayHello': function()
		{
			return 'Hello '+this._name+'. How are you doing today?';
		}
	});

	var p = new SubPerson();
	p.sayHello('Craig', function(message)
	{
		alert(message);
	});

### Static Keyword 

Properties, and methods set to the class versus objects instantiated.

	var Singleton = Structr({
		
		'static getInstance': function()
		{
			return this._instance || (this._instance = new Singleton());
		}
	});
	
	var test1 = Singleton.getInstance();
	var test2 = Singleton.getInstance();
	test2.name = 'Craig';
{'fraction_non_alphanumeric': 0.13172541743970315, 'fraction_numerical': 0.0013914656771799629, 'mean_word_length': 2.2988271290158084, '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': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1607507', 'n_tokens_mistral': 2151, 'n_tokens_neox': 1818, 'n_words': 562}