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

Function bindingScope

examples/binding-resolution/src/util.ts:82–99  ·  view source on GitHub ↗
(
  name: string,
  defaultScope = BindingScope.SINGLETON,
)

Source from the content-addressed store, hash-verified

80 * @param - Default binding scope
81 */
82export function bindingScope(
83 name: string,
84 defaultScope = BindingScope.SINGLETON,
85) {
86 const scopeName = (process.env.BINDING_SCOPE ?? defaultScope).toLowerCase();
87 const scopes = [
88 BindingScope.APPLICATION,
89 BindingScope.SERVER,
90 BindingScope.REQUEST,
91 BindingScope.SINGLETON,
92 BindingScope.TRANSIENT,
93 BindingScope.CONTEXT,
94 ];
95 const scope =
96 scopes.find(s => s.toLowerCase() === scopeName) ?? BindingScope.TRANSIENT;
97 debug('Binding scope for "%s" is set to "%s".', name, scope);
98 return scope;
99}
100
101export async function count(ctx: Context, name: string) {
102 const keys = [REQUEST_COUNTER, SERVER_COUNTER, APPLICATION_COUNTER];

Callers 3

ping.controller.tsFile · 0.90
spy.middleware.tsFile · 0.90
spy.interceptor.tsFile · 0.90

Calls 2

toLowerCaseMethod · 0.80
findMethod · 0.65

Tested by

no test coverage detected