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

Method toAlias

packages/context/src/binding.ts:930–943  ·  view source on GitHub ↗

* Bind the key to an alias of another binding * @param keyWithPath - Target binding key with optional path, * such as `servers.RestServer.options#apiExplorer`

(keyWithPath: BindingAddress<T>)

Source from the content-addressed store, hash-verified

928 * such as `servers.RestServer.options#apiExplorer`
929 */
930 toAlias(keyWithPath: BindingAddress<T>) {
931 /* istanbul ignore if */
932 if (debug.enabled) {
933 debug('Bind %s to alias %s', this.key, keyWithPath);
934 }
935 this._source = {
936 type: BindingType.ALIAS,
937 value: keyWithPath,
938 };
939 this._setValueGetter(({context, options}) => {
940 return context.getValueOrPromise(keyWithPath, options);
941 });
942 return this;
943 }
944
945 /**
946 * Unlock the binding

Callers 8

constructorMethod · 0.80
binding.unit.tsFile · 0.80
bindBooterFunction · 0.80
constructorMethod · 0.80
spyMiddlewareMethod · 0.80
bindResourcesFunction · 0.80
mainFunction · 0.80

Calls 2

_setValueGetterMethod · 0.95
getValueOrPromiseMethod · 0.80

Tested by

no test coverage detected