The main namespace.
Classes
Namespaces
Methods
-
<static> bool(str)
-
Pass in a string and it will be returned as a boolean. If the string is not
trueorfalse, the string passed will be returned.Parameters:
Name Type Description strString The string to convert into a boolean.
Returns:
- Type
- Boolean
-
<static> extend(defaults, options)
-
Merge defaults with user options.
Parameters:
Name Type Description defaultsObject Default settings.
optionsObject User options.
Returns:
Merged values of defaults and options.
- Type
- Object
-
<static> isBool(val)
-
Returns
trueorfalseif value is a boolean.Parameters:
Name Type Description val* Test value.
Returns:
- Type
- Boolean
-
<static> isNum(val)
-
Returns
trueorfalseif value is a number.Parameters:
Name Type Description val* Test value.
Returns:
- Type
- Boolean
-
<static> isString(val)
-
Returns
trueorfalseif value is a string.Parameters:
Name Type Description val* Test value.
Returns:
- Type
- Boolean
-
<static> isUndef(val [, empty])
-
Returns
trueorfalseif a value is undefined.Parameters:
Name Type Argument Default Description val* Test value.
emptyBoolean <optional>
false Checks if the value is empty, i.e. "". If a value is empty and parameter is not set,
falseis returned.Returns:
- Type
- Boolean
-
<static> loop(arr, cb)
-
Loop through an array with callback.
Parameters:
Name Type Description arrArrays The array.
cbfunction Callback function.
Properties
Name Type Description element* The value of the array.
indexNumber The index of the array.
Example
var arr = ['apple', 'orange', 'blueberry', 'strawberry']; ML.loop(arr, function(element, index) { console.log(element); // Will console out: apple, orange, etc... console.log(index); // Will console out the array item's index: 0, 1, etc... }) -
<static> parObj(str, base, sep)
-
Parses a string into an object.
Parameters:
Name Type Description strString String to be parse.
baseString Base of the string to be removed.
sepString Used to separate each property.
Returns:
- Type
- Object
-
<static> trim(str)
-
Returns a string with whitespace removed.
Parameters:
Name Type Description strString String to remove whitespace.
Returns:
- Type
- String
-
<static> urlParams(arg)
-
Returns query paramaters.
Parameters:
Name Type Description argString | Object Query parameter.
Returns:
- Type
- String
Example
var str = 'animal=cat&fruit=apple'; // 'animal=cat&fruit=apple' is returned. var obj = {animal: 'cat', fruit: 'apple'}; // 'animal=cat&fruit=apple' is returned. -
<static> windowDimen()
-
Returns the width and height of the window. credit
Returns:
- Type
- Object