Returns the closest matching entry, tracing path in an array, Map or simple object.
Returns an entry with undefined value at the point where tracing stopped.
Use traceByPath to step through all the segments.
* constpeople = { * jane: { address: { postcode:1000, * street:'West St', * city:'Blahville' }, colour:'red' * } } Trees.getByPath('jane.address.postcode', people); // '.' default separator // ['postcode', 1000] Trees.getByPath('jane.address.country.state', people); // ['country', undefined] - since full path could not be resolved.
Returns the closest matching entry, tracing
path
in an array, Map or simple object. Returns an entry with undefined value at the point where tracing stopped. Use traceByPath to step through all the segments.