Methods
(static) Date() → {object}
Gets the a format function
Returns:
The TimeStamp function
- Type
- object
(static) FormatMiliseconds(duration)
Formats miliseconds to HH:MM:SS.mm
Parameters:
| Name | Type | Description |
|---|---|---|
duration |
number | The miliseconds |
(static) Log(text)
Logs a string or object
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string | object | The string or object to print |
(static) LogError(text, erroropt)
Logs an error with a description and the error object
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
text |
string | object | The string or object description | |
error |
object |
<optional> |
Error object |
(static) LogObject(object)
Logs an object
Parameters:
| Name | Type | Description |
|---|---|---|
object |
object | The object to log |
(static) LogWarning(text)
Logs a warning with a string or object
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string | object | The string or object to print |
(static) SetDrawer(customDrawer)
Sets an external drawer function to export the logs
Parameters:
| Name | Type | Description |
|---|---|---|
customDrawer |
function | The external function |
(static) Stats()
Prints the current stats of the Logs such as Log, Warning and Error counts
(static) ValidateInput(params, types, optionalTypes) → {bool}
Validates the input of a functionAn array object can be checked with array[type]
Examples
function test(value){ return $d.ValidateInput(arguments, ["boolean"]);}//Returns truetest(true);//Returns false and Error Logtest("A");
function test(name, obj, vars, duration){ return $d.ValidateInput(arguments, ["string","object","array[string]"],["number"]);}//Returns truetest("Test", {obj: 1}, ["Test1","Test2"]);//Returns truetest("Test", {obj: 1}, ["Test1","Test2"], 1);//Returns false and Error Logtest("Test", {obj: 1}, [1,2], 1);
Parameters:
| Name | Type | Description |
|---|---|---|
params |
Array.<object> | The function received params |
types |
Array.<string> | The expected type of params |
optionalTypes |
Array.<string> | The optional type of params |
Returns:
If the input is valid returns true, otherwise returns false
- Type
- bool