Globals
These functions are not part of an Object and can be called in the global namespace.
Methods
btoa(stringToEncode) → {String}
Returns a string containing the Base64 representation of stringToEncode.
Parameters:
Name Type Description stringToEncode String A string whose characters each represent a single byte of binary data to be encoded into ASCII.
Returns:
clone(obj) → {Object}
Returns a (deep) clone of the given Object or Array.
Parameters:
Name Type Description obj Object Object to clone.
Returns:
The cloned object.
contains(needle, haystack, alt) → {String}
Check if a value is contained within the provided item.
Parameters:
Name Type Argument Default Description needle * Value to search for.
haystack Object | Array | String Value to search within.
alt alt optional false Check in object for value instead of key.
Returns:
Uppercased String or empty string when none was provided.
empty(obj) → {Boolean}
Determines if the passed value is "empty".
Parameters:
Name Type Description obj Object Value to check.
Returns:
true if the value is "emtpy", false otherwise.
emptyFn()
Any empty function that does nothing.
extend(target, source) → {Object}
Extend one Object with the properties from another.
Parameters:
Name Type Description target Object Object to extend.
source Object Object to copy properties from.
Returns:
The extended Object.
isArray(param) → {Boolean}
Returns if param is an Array.
Parameters:
Name Type Description param Any The value to be checked.
Returns:
isBoolean(param) → {Boolean}
Returns if param is a Boolean.
Parameters:
Name Type Description param Any The value to be checked.
Returns:
isDate(param) → {Boolean}
Returns if param is a Date.
Parameters:
Name Type Description param Any The value to be checked.
Returns:
isDefined(obj) → {Boolean}
Check if a vlue is defined.
Parameters:
Name Type Description obj * Value to check.
Returns:
true if the value is defined, false otherwise.
isEmpty(param) → {Boolean}
Returns true if param is "empty", undefined, null or zero length.
Parameters:
Name Type Description param Any The value to be checked.
Returns:
isFunction(param) → {Boolean}
Returns if param is a Function.
Parameters:
Name Type Description param Any The value to be checked.
Returns:
isNumber(param) → {Boolean}
Returns if param is a Number.
Parameters:
Name Type Description param Any The value to be checked.
Returns:
isRegExp(param) → {Boolean}
Returns if param is a Regular Expression.
Parameters:
Name Type Description param Any The value to be checked.
Returns:
isString(param) → {Boolean}
Returns if param is a String.
Parameters:
Name Type Description param Any The value to be checked.
Returns:
isUndefined(obj) → {Boolean}
Check if a value is undefined.
Parameters:
Name Type Description obj * Value to check.
Returns:
true if the value is undefined, false otherwise.
later(when, fn, scope, data, periodic) → {Object}
Execute the given function at a later moment in time.
Parameters:
Name Type Argument Default Description when Number Time to wait before executing the function in milliseconds.
fn function | String Function to execute.
scope Object Scope to use when executing the function.
data * Arguments to use when executing the function.
periodic Boolean optional false Execute the function periodically instead of just once.
Returns:
An Object with an interval property and cancel method.
lower(str) → {String}
Convert a String to lowercase.
Parameters:
Name Type Argument Description str String optional String to convert.
Returns:
Lowercased String or empty string when none was provided.
md5(param) → {String}
Returns an MD5 hash of param.
Parameters:
Name Type Description param Any The value to hash.
Returns:
merge(obj) → {Object}
Recursively merge multiple Objects together.
Parameters:
Name Type Argument Default Description obj Object optional {} Objects to merge.
Returns:
Merged Object or empty Object when no parameters where given.
otab(encodedData) → {String}
Parameters:
Name Type Description encodedData String The data to decode.
Throws:
The length of passed-in string must be a multiple of 4.
- Type
- DOMException
Returns:
The decoded data.
parseQueryVariables(s) → {Object}
Parses a URL querystring into an Object.
Parameters:
Name Type Description s String Querystring to parse.
Returns:
Parsed querystring.
parseWithRegExp(text, reg, processValue) → {Object}
Parses a String with the given Regular Expression and returns the result in an Object.
Parameters:
Name Type Argument Description text String String to parse.
reg RegEx Regular Expression to use.
processValue function optional Optional Function to run on results.
Returns:
Parsed result.
queue(funcs, scope)
Helper function for calling async functions in order.
Parameters:
Name Type Argument Default Description funcs Array Array of functions to execute in specific order. Each function get's invoked with a callback argument as the first parameter. And any given arguments as well.
scope Object optional {} The (shared) scope to use when invoking each function.
random(limit) → {Number}
Returns a integer, pseudo-random number in the range [0, limit].
Parameters:
Name Type Argument Default Description limit Number optional 1000 Upper limit for random number.
Returns:
The random number.
splat(obj) → {Array}
Check if a value is contained within the provided item.
Parameters:
Name Type Description obj * .
Returns:
.
typeOf(exp) → {String}
Returns a string indicating the type of exp.
Parameters:
Name Type Description exp Any An expression representing the object or primitive whose type is to be returned.
Returns:
The string indicating the type of exp.