Explorar o código

[DOC] Core: Finished

soyjavi %!s(int64=13) %!d(string=hai) anos
pai
achega
bfda6e6782
Modificáronse 1 ficheiros con 201 adicións e 14 borrados
  1. 201 14
      docs/EN/core.md

+ 201 - 14
docs/EN/core.md

@@ -2,16 +2,21 @@ Lungo - *Cross-Device Framework*
 ================================
 
 ## 3.1 Core
-Lungo has several functions that are used inside its engine. Here you have them if you need to include some of their funcitonality in your application.
+Lungo has several methods that are used inside its engine. Here you have them if you need to include some of their functionality in your application.
+
 
 ### 3.1.1 log()
 Console system to display messages when you are in debug mode.
-##### Parameters
-```json
+
+**PARAMETERS**
+
+```
 number: 	Severity based in (1)Log, (2)Warn, (>2)Error
 string: 	Message to show in the console
 ```
-##### Example
+
+**EXAMPLE**
+
 ```
 Lungo.Core.log(1, "Launched event");
 Lungo.Core.log(2, "Warning!!");
@@ -21,11 +26,15 @@ Lungo.Core.log(3, "Error!!!!");
 
 ### 3.1.2 execute()
 Executes callbacks based on the parameters received. 
-##### Parameters
-```json
+
+**PARAMETERS**
+
+```
 function:	callback to execute
 ```
-##### Example
+
+**EXAMPLE**
+
 ```
 var myFunc = function(){
     //Do something
@@ -39,16 +48,17 @@ Lungo.Core.execute(myFunc, myFunc2);
 
 ### 3.1.3 bind()
 Creates a new function that, when called, itself calls this function in the context of the provided this value, with a given sequence of arguments preceding any provided when the new function was called. 
-##### Parameters
-```json
+
+**PARAMETERS**
+
+```
 object:		object that 'this' can refer in the new function.
 function:	A function object.
 ```
-##### Return
-```
-Return:		The function which will do the action on the object.
-```
-##### Example
+This method **return** the function which will do the action on the object.
+
+**EXAMPLE**
+
 ```
 var example = "This is ";
 var addText = function(textToAdd){
@@ -62,3 +72,180 @@ var text = ["an", "example"];
 var finalText = Lungo.Core.bind(example, addText)(text);
 //Result: "This is an example"
 ```
+
+
+### 3.1.4 mix()
+Copy from any number of objects and mix them all into a new object. The implementation is simple; just loop through arguments and copy every property of every object passed to the function. 
+
+**PARAMETERS**
+
+```
+object:	 	arguments to mix them all into a new object.
+object: 	arguments to mix them all into a new object.
+```
+This method **return** an object with the mix done.
+
+**EXAMPLE**
+
+```
+var CONFIG_BASE = {
+    name: 'lungo_db',
+    version: '1.0'
+};
+
+var CONFIG = {
+    version: '1.1';
+}
+
+var finalConfig = lng.Core.mix(CONFIG_BASE, CONFIG);
+
+/*
+Result:
+{
+    name: 'lungo_db',
+    version: '1.1'
+}
+*/
+```
+
+
+### 3.1.5 isOwnProperty()
+Every object descended from Object inherits the hasOwnProperty method. This method can be used to determine whether an object has the specified property as a direct property of that object. 
+
+**PARAMETERS**
+
+```
+object: 	object to test for a property's existence inside itself.
+string:		property the name of the property to test.
+```
+This method **return** boolean indicating if property exists.
+
+**EXAMPLE**
+
+```
+var car = {wheels:4,doors:true};
+Lungo.Core.isOwnProperty(car,"wheels");	//Result: true
+Lungo.Core.isOwnProperty(car,"wings");		//Result: false
+```
+
+
+### 3.1.6 toType()
+Determine the internal JavaScript [[Class]] of an object. 
+
+**PARAMETERS**
+
+```
+object:		object to get the real type of itself.
+```
+This method **return** a string with the internal JavaScript [[Class]]
+
+**EXAMPLE**
+
+```
+var name = "Lungo";
+Lungo.Core.toType(name);	//Result: "string"
+```
+
+
+### 3.1.7 toArray()
+Convert an array-like object into a true JavaScript array. 
+
+**PARAMETERS**
+
+```
+object:		Any object to turn into a native Array.
+```
+This method **return** the object in a plain array.
+
+**EXAMPLE**
+
+```
+var execute = function() {
+	var args = lng.Core.toArray(arguments);
+}
+```
+
+
+### 3.1.8 isMobile()
+Determine if the current environment is a mobile environment. This method **return** An object with the mix done.
+
+**EXAMPLE**
+
+```
+Lungo.Core.isMobile();
+```
+
+
+### 3.1.9 environment()
+**Returns** information of execute environment.
+
+**EXAMPLE**
+
+```
+Lungo.Core.environment();
+```
+
+
+### 3.1.10 orderByProperty()
+Copy from any number of objects and mix them all into a new object. The implementation is simple; just loop through arguments and copy every property of every object passed to the function. 
+
+**PARAMETERS**
+
+```
+list:		List of objects.
+string:		Name of the property.
+string: 	Type of order: asc or desc.
+```
+This method **return** an ordered list of objects by a property.
+
+**EXAMPLE**
+
+```
+var list = [
+    {name: 'Lungo', twitter: 'lungojs'},
+    {name: 'Quojs', twitter: 'quojs'},
+];
+
+var ordered_list = lng.Core.orderByProperty(list, 'name', 'asc');
+```
+
+
+### 3.1.11 parseUrl()
+
+**PARAMETERS**
+
+```
+string:		Url string.
+```
+This method **return**  a correct URL using hashtag character.
+
+**EXAMPLE**
+
+```
+var url = Lungo.Core.parseUrl("http://tapquo.com/#folks");
+//Result: "#folks"
+```
+
+
+### 3.1.12 findByProperty()
+Copy from any number of objects and mix them all into a new object. The implementation is simple; just loop through arguments and copy every property of every object passed to the function. 
+
+**PARAMETERS**
+
+```
+list:		The list with objects.
+string:		Name of the property.
+```
+This method **return** An instance of the object found, null if not found.
+
+**EXAMPLE**
+
+```
+var list = [
+    {name: 'Lungo', twitter: 'lungojs'},
+    {name: 'Quojs', twitter: 'quojs'},
+];
+
+var user = lng.Core.findByProperty(list, 'name', 'Lungo');
+```
+```