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

Method validate

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

* Validate the binding key format. Please note that `#` is reserved. * Returns a string representation of the binding key. * * @param key - Binding key, such as `a`, `a.b`, `a:b`, or `a/b`

(key: BindingAddress<T>)

Source from the content-addressed store, hash-verified

69 * @param key - Binding key, such as `a`, `a.b`, `a:b`, or `a/b`
70 */
71 static validate<T>(key: BindingAddress<T>): string {
72 if (!key) throw new Error('Binding key must be provided.');
73 key = key.toString();
74 if (key.includes(BindingKey.PROPERTY_SEPARATOR)) {
75 throw new Error(
76 `Binding key ${key} cannot contain` +
77 ` '${BindingKey.PROPERTY_SEPARATOR}'.`,
78 );
79 }
80 return key;
81 }
82
83 /**
84 * Parse a string containing both the binding key and the path to the deeply

Callers 10

constructorMethod · 0.80
unbindMethod · 0.80
containsMethod · 0.80
getBindingMethod · 0.80
createMethod · 0.80
setOptionsMethod · 0.80
loadSpecFunction · 0.80
buildMiddlewareKeysMethod · 0.80

Calls 1

toStringMethod · 0.45

Tested by 1