util/ensure

Ensure that a property is present in an object, initializing it to a default value if it is not already defined. Modifies the provided object by reference.

Source:
Parameters:
Name Type Description
obj object

The object in which to ensure a property exists

prop string

The property key to ensure

propDefaultValue

The default value for the property

Returns:
Type:
void