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

Function asBindingTemplate

packages/context/src/binding-inspector.ts:122–137  ·  view source on GitHub ↗
(
  scopeAndTags: BindingScopeAndTags,
)

Source from the content-addressed store, hash-verified

120 * @typeParam T - Value type
121 */
122export function asBindingTemplate<T = unknown>(
123 scopeAndTags: BindingScopeAndTags,
124): BindingTemplate<T> {
125 return function applyBindingScopeAndTag(binding) {
126 if (scopeAndTags.scope) {
127 binding.inScope(scopeAndTags.scope);
128 }
129 if (scopeAndTags.tags) {
130 if (Array.isArray(scopeAndTags.tags)) {
131 binding.tag(...scopeAndTags.tags);
132 } else {
133 binding.tag(scopeAndTags.tags);
134 }
135 }
136 };
137}
138
139/**
140 * Get binding metadata for a class

Callers 1

injectableFunction · 0.90

Calls 2

inScopeMethod · 0.80
tagMethod · 0.80

Tested by

no test coverage detected