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

Method create

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

* Create a new key for a binding bound to a value of type `ValueType`. * * @example * * ```ts * BindingKey.create ('application.name'); * BindingKey.create ('config', 'rest.port); * BindingKey.create ('config#rest.port'); * ``` * * @param key - The

(key: string, propertyPath?: string)

Source from the content-addressed store, hash-verified

27 * @param propertyPath - Optional path to a deep property of the bound value.
28 */
29 public static create<V>(key: string, propertyPath?: string): BindingKey<V> {
30 // TODO(bajtos) allow chaining of propertyPaths, e.g.
31 // BindingKey.create('config#rest', 'port')
32 // should create {key: 'config', path: 'rest.port'}
33 if (propertyPath) {
34 BindingKey.validate(key);
35 return new BindingKey<V>(key, propertyPath);
36 }
37
38 return BindingKey.parseKeyWithPath(key);
39 }
40
41 private constructor(
42 public readonly key: string,

Callers

nothing calls this directly

Calls 2

validateMethod · 0.80
parseKeyWithPathMethod · 0.80

Tested by

no test coverage detected