Returns first found value at given list of paths of given object. Will return and stop at undefined if found! If
nothing is found then default value (required to pass) will be returned.
This is still too dynamic in nature to get full TypeScript support. Properties are not typed, return type is unknown.
If your data access is statically known there is no need to use this function, just use object.property syntax with
optional chaining.
See
get - for base usage example with single path only
Example
getMultiple(obj, 5, "details.error.message", ["error", "message"], "errorMessage") // will look for obj.details.error.message - if path does not exist // will look for obj.error.message - if not defined // will look for obj.errorMessage - if not defined // will return 5
Returns first found value at given list of paths of given object. Will return and stop at undefined if found! If nothing is found then default value (required to pass) will be returned.
This is still too dynamic in nature to get full TypeScript support. Properties are not typed, return type is unknown. If your data access is statically known there is no need to use this function, just use
object.property
syntax with optional chaining.See
get - for base usage example with single path only
Example