new ObjectHelper()
Static helper class for objects
Methods
-
<static> createFromString(path)
-
Create object from path
Parameters:
Name Type Description pathstring path to object from window Returns:
created object- Type
- object
Example
namespace.Object
-
<static> each(obj, callback, context)
-
Loop object and call calbback for each item
Parameters:
Name Type Description objobject object callbackfunction callback function contextobject | null scope of the callback -
<static> extractKeys(source)
-
Extracts all keys of object and returns as array of strings
Parameters:
Name Type Description sourceobject object Returns:
keys- Type
- array.<string> | null
-
<static> getChildObject(obj, path)
-
Get deep child of the object using path
Parameters:
Name Type Description objobject object pathstring path to property Returns:
value of property- Type
- * | null
Example
Object: {a:{a:{a:1}}} Path: a.a.a -
<static> getConstructorFromString(path)
-
Searches for object constructor by string
Parameters:
Name Type Description pathstring path to object from window Returns:
constructor- Type
- function
Example
namespace.Object
-
<static> hasDeepProperty(obj, propertyName)
-
Checsks if object has property
Parameters:
Name Type Description objobject object propertyNamestring name of the property Returns:
has / has not- Type
- boolean
-
<static> hasKey(obj, key)
-
Check if object has key
Parameters:
Name Type Description objobject object keystring id of property Returns:
has/has not- Type
- boolean
-
<static> isFunction(obj)
-
Checks if element is of type Function
Parameters:
Name Type Description obj* element to check Returns:
is/is not- Type
- boolean
-
<static> isInstanceOf(obj, type)
-
Check if objects is of specific type
Parameters:
Name Type Description objobject object typestring type to check Returns:
is / is not- Type
- boolean
-
<static> isObject(obj)
-
Checks if element is of type Object
Parameters:
Name Type Description obj* element to check Returns:
is/is not- Type
- boolean