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:

NameTypeDescription
stringToEncodeString

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:

NameTypeDescription
objObject

Object to clone.

Returns:

The cloned object.

contains(needle, haystack, alt) → {String}

Check if a value is contained within the provided item.

Parameters:

NameTypeArgumentDefaultDescription
needle*

Value to search for.

haystackObject | Array | String

Value to search within.

altaltoptional 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:

NameTypeDescription
objObject

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:

NameTypeDescription
targetObject

Object to extend.

sourceObject

Object to copy properties from.

Returns:

The extended Object.

isArray(param) → {Boolean}

Returns if param is an Array.

Parameters:

NameTypeDescription
paramAny

The value to be checked.

Returns:

isBoolean(param) → {Boolean}

Returns if param is a Boolean.

Parameters:

NameTypeDescription
paramAny

The value to be checked.

Returns:

isDate(param) → {Boolean}

Returns if param is a Date.

Parameters:

NameTypeDescription
paramAny

The value to be checked.

Returns:

isDefined(obj) → {Boolean}

Check if a vlue is defined.

Parameters:

NameTypeDescription
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:

NameTypeDescription
paramAny

The value to be checked.

Returns:

isFunction(param) → {Boolean}

Returns if param is a Function.

Parameters:

NameTypeDescription
paramAny

The value to be checked.

Returns:

isNumber(param) → {Boolean}

Returns if param is a Number.

Parameters:

NameTypeDescription
paramAny

The value to be checked.

Returns:

isRegExp(param) → {Boolean}

Returns if param is a Regular Expression.

Parameters:

NameTypeDescription
paramAny

The value to be checked.

Returns:

isString(param) → {Boolean}

Returns if param is a String.

Parameters:

NameTypeDescription
paramAny

The value to be checked.

Returns:

isUndefined(obj) → {Boolean}

Check if a value is undefined.

Parameters:

NameTypeDescription
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:

NameTypeArgumentDefaultDescription
whenNumber

Time to wait before executing the function in milliseconds.

fnfunction | String

Function to execute.

scopeObject

Scope to use when executing the function.

data*

Arguments to use when executing the function.

periodicBooleanoptional 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:

NameTypeArgumentDescription
strStringoptional 

String to convert.

Returns:

Lowercased String or empty string when none was provided.

md5(param) → {String}

Returns an MD5 hash of param.

Parameters:

NameTypeDescription
paramAny

The value to hash.

Returns:

merge(obj) → {Object}

Recursively merge multiple Objects together.

Parameters:

NameTypeArgumentDefaultDescription
objObjectoptional {}

Objects to merge.

Returns:

Merged Object or empty Object when no parameters where given.

otab(encodedData) → {String}

Parameters:

NameTypeDescription
encodedDataString

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:

NameTypeDescription
sString

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:

NameTypeArgumentDescription
textString

String to parse.

regRegEx

Regular Expression to use.

processValuefunctionoptional 

Optional Function to run on results.

Returns:

Parsed result.

queue(funcs, scope)

Helper function for calling async functions in order.

Parameters:

NameTypeArgumentDefaultDescription
funcsArray

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.

scopeObjectoptional {}

The (shared) scope to use when invoking each function.

random(limit) → {Number}

Returns a integer, pseudo-random number in the range [0, limit].

Parameters:

NameTypeArgumentDefaultDescription
limitNumberoptional 1000

Upper limit for random number.

Returns:

The random number.

splat(obj) → {Array}

Check if a value is contained within the provided item.

Parameters:

NameTypeDescription
obj*

.

Returns:

.

typeOf(exp) → {String}

Returns a string indicating the type of exp.

Parameters:

NameTypeDescription
expAny

An expression representing the object or primitive whose type is to be returned.

Returns:

The string indicating the type of exp.

unescapeUnicode(text) → {String}

Converts unicode to a text String.

Parameters:

NameTypeDescription
textString

unicode to convert.

Returns:

Converted unicode.

upper(str) → {String}

Convert a String to uppercase.

Parameters:

NameTypeArgumentDescription
strStringoptional 

String to convert.

Returns:

Uppercased String or empty string when none was provided.