Helper

Helper class provides static helper functions.

Constructor

new Helper()

Methods

(static) createObservable(onChangeopt, objReferenceopt, batchUpDelayopt) → {ProxyConstructor}

Create an observable object

Parameters:
NameTypeAttributesDefaultDescription
onChangefunction<optional>

Callback triggered on change. Default is undefined.

objReferenceobject<optional>

Referenced object which will be transformed to an observable. Default is an empty new object.

batchUpDelayboolean<optional>
true

Flag defining if change events are batched up for 10ms before being triggered. Default is true.

Returns:
Type: 
ProxyConstructor

(static) createUid() → {string}

Creates an unique ID

Throws:
  • If crypto module is not available
Type
Error
Returns:
Type: 
string

(static) deepMerge(target, …sources) → {Object}

Deep merges two objects into target

Parameters:
NameTypeAttributesDescription
targetObject
sourcesObject<repeatable>
Returns:
Type: 
Object
Example
const merged = mergeDeep({a: 1}, { b : { c: { d: { e: 12345}}}});
// => { a: 1, b: { c: { d: [Object] } } }

(static) isArray(v) → {boolean}

Checks if given value is an array or not

Parameters:
NameTypeDescription
v*

Value to check

Returns:
Type: 
boolean

(static) isClass(v) → {boolean}

Checks if given value is a class constructor

Parameters:
NameTypeDescription
v
Returns:
Type: 
boolean

(static) isPlainObject(value) → {boolean}

Checks if given value is a plain object

Parameters:
NameTypeDescription
value
Returns:
Type: 
boolean

(static) isString(v) → {boolean}

Checks if given value is string

Parameters:
NameTypeDescription
v*

Value to check

Returns:
Type: 
boolean

(static) serializeForm(form) → {object}

Serialize given from

Parameters:
NameTypeDescription
formHTMLFormElement

The form element to serialize

Returns:
  • Plain javascript object containing the name and value of given form.
Type: 
object

(static) trim(str, characters, flags) → {string}

Parameters:
NameTypeDefaultDescription
strstring

String to trim

charactersstring | undefined

Characters to trim. Default is empty space.

flagsstring | undefinedg

RegExp flag. Default is "g"

Returns:
Type: 
string