Class: PropertyHelper

coreutils. PropertyHelper


new PropertyHelper()

Static helper class for working with object properties. Used for bindings.

Methods


<static> convertPathToArray(property)

Convert property path to array
Parameters:
Name Type Description
property string property path
Returns:
path as array
Type
array.<string>
Example
Path: prop.prop[0][0].prop
Result: [prop,prop,[0],[0],prop]

<static> getProperty(property, root)

Get property value by path
Parameters:
Name Type Description
property array.<string> | string property path
root object | undefined start point for search
Returns:
result
Type
* | null

<static> getPropertyField(property, root)

Get property by path
Parameters:
Name Type Description
property array.<string> | string property path
root object | undefined start point for search
Returns:
result
Type
object | array

<static> hasProperty(property, root)

Check if object has property
Parameters:
Name Type Description
property array.<string> | string property path
root object | undefined start point for search
Returns:
has / has not
Type
boolean

<static> isPropertyArray(property)

Check if property is array
Parameters:
Name Type Description
property string property
Returns:
is / is not
Type
boolean
Example
Prop: prop[0] returns true
Prop: prop returns false

<static> setProperty(property, value, root)

Set property by path
Parameters:
Name Type Description
property array.<string> | string property path
value * property value
root object | undefined start point for search

<static> walkThroughProperties(elements, root, callback, scope)

Deep walk through proeprty and calls callback on each element
Parameters:
Name Type Description
elements array.<string> property path
root object root object
callback function
scope object | null