MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / parseKeyWithPath

Method parseKeyWithPath

packages/context/src/binding-key.ts:90–104  ·  view source on GitHub ↗

* Parse a string containing both the binding key and the path to the deeply * nested property to retrieve. * * @param keyWithPath - The key with an optional path, * e.g. "application.instance" or "config#rest.port".

(keyWithPath: BindingAddress<T>)

Source from the content-addressed store, hash-verified

88 * e.g. "application.instance" or "config#rest.port".
89 */
90 static parseKeyWithPath<T>(keyWithPath: BindingAddress<T>): BindingKey<T> {
91 if (typeof keyWithPath !== 'string') {
92 return BindingKey.create<T>(keyWithPath.key, keyWithPath.propertyPath);
93 }
94
95 const index = keyWithPath.indexOf(BindingKey.PROPERTY_SEPARATOR);
96 if (index === -1) {
97 return new BindingKey<T>(keyWithPath);
98 }
99
100 return BindingKey.create<T>(
101 keyWithPath.slice(0, index).trim(),
102 keyWithPath.slice(index + 1),
103 );
104 }
105
106 /**
107 * Name space for configuration binding keys

Callers 3

getValueOrPromiseMethod · 0.80
createMethod · 0.80

Calls 1

createMethod · 0.65

Tested by

no test coverage detected