source object to search in
path to the expected value written as dot-separated property names or array with property names. Use Array when your keys includes dots. Keys are treated literally, no parsing is done on keys.
Optional
defaultValue: unknown = undefinedvalue to return if path is not found. If path is found, but the value is undefined -
default value will NOT be used, use get(...) || default
instead
Generated using TypeDoc
Returns the value at given path of given object. If path is not found then default value is returned. No exceptions are thrown when undefined/null value gets in the way.
Example
get(object, "deep.property") // equals to safe
object.deep.property
Example
Example
Example
get(object, "very.deep.property", 5) // if object.very.deep has also
property
property then it value will be returned, even if undefined // else5
will be returnedReturns