Function
getWithDefault (obj, keyName, defaultValue) Object public
Module:
@ember/object
Defined in packages/ember-metal/lib/property_get.ts:182
import { getWithDefault } from '@ember/object'; |
- obj
- Object
- The object to retrieve from.
- keyName
- String
- The name of the property to retrieve
- defaultValue
- Object
- The value to return if the property value is undefined
- returns
- Object
- The property value or the defaultValue.
Retrieves the value of a property from an Object, or a default value in the
case that the property returns undefined
.
1 2 |
import { getWithDefault } from ' /object'; getWithDefault(person, 'lastName', 'Doe'); |