Source file
Core utility methods
Clone an object.
Parameters
Type
Description
obj
Object
**
return
undefined
cloned object.
Generates a device fingerprint based on rendering data on a canvas element - See https://en.wikipedia.org/wiki/Canvas_fingerprinting
Parameters
Type
Description
return
String
- An identifier known to be relatively unique per device
Converts a data URL to a Blob and returns a Blob URL.
Parameters
Type
Description
dataurl
URL
**
return
undefined
Blob URL
Converts a Blob into a dataUrl
Parameters
Type
Description
blob
*
**
return
undefined
data URL
getObjectValue(obj, path, def) ►
Parameters
Type
Description
obj
Object
the object to get a property from
path
String
path to the property
def
Any
default to return if the property is undefined
return
undefined
The value of the property as retrieved
stringifyJs(jsLiteral, replacer, indent) ►
Does JS code stringification comparable to JSON.stringify()
Parameters
Type
Description
jsLiteral
Object
the JavaScript literal to stringify
replacer
function
**
indent
Number
**
return
undefined
String
Returns appropriate use of the given key for identifiers
Parameters
Type
Description
key
*
**
return
undefined
The adequately quoted or non-quoted identifier name
Returns true if the given name is valid as variable name
Parameters
Type
Description
name
*
**
return
undefined
Boolean value indicating whether the given name is a valid variable name
scopeEval(scope, script) ►
Evaluates a script in the given scope
Parameters
Type
Description
scope
Object
the 'this' scope for the script to run in
script
String
the script to execute
return
undefined
The return value of the script, if any
resolveVariables(str, cb, ar) ►
Resolve variables in strings
Parameters
Type
Description
str
*
the string to parse
cb
*
callback for each var replacement
ar
*
array to fill with matches
return
undefined
the string with the resolved variables
acquireState(data, options) ►
Acquire state from multiple possible sources.
Parameters
Type
Description
data
Any
input data. Can be either direct data, URL, function or Promise
options
*
optional options to pass to Promise, function
return
undefined
Object or Array
Checks whether the fiven string is a valid URL.
Parameters
Type
Description
txt
String
the string to evaluate
return
undefined
Boolean indeicating whether the string is a URL.
setObjectValue(obj, path, value)
Counterpart of GetObjectValue
Parameters
Type
Description
obj
Object
the object to set a shallow or deep property on
path
String
the path to the property to set
value
Any
the value to set
Does a deep merge of two objects, whereas using the spread operator (...) only does a shallow merge.
Parameters
Type
Description
obj1
Object
the object to be merged into
obj2
Object
the object to be merged from
Helper for GetObjectProperty and GetObjectProperty
Parameters
Type
Description
path
String
**
return
undefined
Array
compare(operator, a, b) ►
Compares values using the built in operator table
Parameters
Type
Description
operator
String
**
a
Object
**
b
Object
**
return
undefined
Boolean
Returns a random GUID
Parameters
Type
Description
return
undefined
string (36 characters)
Returns a hash code from the given string
Parameters
Type
Description
s
String
**
return
undefined
hash code
waitFor(f, timeoutMs, intervalMs) ►
Waits for a given condition in a promise.
Parameters
Type
Description
f
function
the function to evaluate whether waiting should end
timeoutMs
Number
total time to wait if the given function still doesn't return true
intervalMs
Number
interval to wait between each function evaluation (in milliseconds) - Defaults to 20.
return
undefined
Promise that resolves when the evaluating function provided return true, or gets rejected when the timeout is reached.
Formats a number as human-friendly byte size
Parameters
Type
Description
size
Number
**
return
undefined
String like 20KB, 1.25MB, 6.25GB, etc.
Name
Type
Description
Events
undefined
Events Class
MarkDown
undefined
MarkDown wrapper
SimpleCache
undefined
Caching class