MCPcopy
hub / github.com/loopbackio/loopback-next / getDeepProperty

Function getDeepProperty

packages/context/src/value-promise.ts:54–67  ·  view source on GitHub ↗
(
  value: IN,
  path: string,
)

Source from the content-addressed store, hash-verified

52 * @param path - Path to the property
53 */
54export function getDeepProperty<OUT = BoundValue, IN = BoundValue>(
55 value: IN,
56 path: string,
57): OUT | undefined {
58 let result: BoundValue = value;
59 const props = path.split('.').filter(Boolean);
60 for (const p of props) {
61 if (result == null) {
62 return undefined;
63 }
64 result = result[p];
65 }
66 return <OUT>result;
67}
68
69/**
70 * Resolve entries of an object into a new object with the same keys. If one or

Callers 3

getValueOrPromiseMethod · 0.90
valuesMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected