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

Function invokeTargetMethod

packages/context/src/invocation.ts:251–269  ·  view source on GitHub ↗

* Invoke the target method * @param ctx - Context object * @param target - Target class or object * @param methodName - Target method name * @param args - Arguments

(
  ctx: Context, // Not used
  target: object,
  methodName: string,
  args: InvocationArgs,
)

Source from the content-addressed store, hash-verified

249 * @param args - Arguments
250 */
251function invokeTargetMethod(
252 ctx: Context, // Not used
253 target: object,
254 methodName: string,
255 args: InvocationArgs,
256): InvocationResult {
257 const targetWithMethods = target as Record<string, Function>;
258 /* istanbul ignore if */
259 if (debug.enabled) {
260 debug('Invoking method %s', getTargetName(target, methodName), args);
261 }
262 // Invoke the target method
263 const result = targetWithMethods[methodName](...args);
264 /* istanbul ignore if */
265 if (debug.enabled) {
266 debug('Method invoked: %s', getTargetName(target, methodName), result);
267 }
268 return result;
269}

Callers 3

invokeTargetMethodMethod · 0.85
invokeMethodFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected