@opra/nestjs
Version:
Opra NestJS module
21 lines (20 loc) • 564 B
JavaScript
/**
* Factory class that provides parameters for NestJS RPC controllers.
*/
export class RpcParamsFactory {
/**
* Exchanges a metadata key for a value from the arguments.
*
* @param type - The metadata type.
* @param data - The metadata data.
* @param args - The arguments array.
* @returns The first argument if available, otherwise null.
*/
exchangeKeyForValue(type, data, args) {
if (!args) {
return null;
}
args = Array.isArray(args) ? args : [];
return args[0];
}
}