Objects

Helper for low-level Object manipulation.

While documented on ObjectHelper, the following static methods are implemented by this class:

Functions

5
getPathstatic

Returns value for a given path in the object

ParameterTypeDescription
objectObject

Object to check path on

pathString

Dot-separated path, e.g. 'object.childObject.someKey'

Returns: * -

Value associated with passed key

Returns value for a given path in the object, placing a passed default value in at the leaf property and filling in undefined properties all the way down.

ParameterTypeDescription
objectObject

Object to get path value for.

pathString | Number | String[] | Number[]

Dot-separated path, e.g. 'firstChild.childObject.someKey', or the key path as an array, e.g. ['firstChild', 'childObject', 'someKey'].

defaultValue*

Optionally the value to put in as the someKey property.

Returns: * -

Value at the leaf position of the path.

Finds a property descriptor for the passed object from all inheritance levels.

ParameterTypeDescription
objectObject

The Object whose property to find.

propertyNameString

The name of the property to find.

Returns: Object -

An ECMA property descriptor is the property was found, otherwise null

hasPathstatic

Determines if the specified path exists

ParameterTypeDescription
objectObject

Object to check path on

pathString

Dot-separated path, e.g. 'object.childObject.someKey'

Returns: Boolean
setPathstatic

Sets value for a given path in the object

ParameterTypeDescription
objectObject

Target object

pathString

Dot-separated path, e.g. 'object.childObject.someKey'

value*

Value for a given path

Returns: Object -

Returns passed object