当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript utils.isFunction方法代码示例

本文整理汇总了TypeScript中@nestjs/common/utils/shared.utils.isFunction方法的典型用法代码示例。如果您正苦于以下问题:TypeScript utils.isFunction方法的具体用法?TypeScript utils.isFunction怎么用?TypeScript utils.isFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@nestjs/common/utils/shared.utils的用法示例。


在下文中一共展示了utils.isFunction方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: isFunction

 .filter(prop => {
   const descriptor = Object.getOwnPropertyDescriptor(prototype, prop);
   if (descriptor.set || descriptor.get) {
     return false;
   }
   return !isConstructor(prop) && isFunction(prototype[prop]);
 })
开发者ID:SARAVANA1501,项目名称:nest,代码行数:7,代码来源:metadata-scanner.ts

示例2: transformToResult

 public async transformToResult(resultOrDeffered) {
   if (resultOrDeffered instanceof Promise) {
     return await resultOrDeffered;
   } else if (resultOrDeffered && isFunction(resultOrDeffered.subscribe)) {
     return await resultOrDeffered.toPromise();
   }
   return resultOrDeffered;
 }
开发者ID:a1r0,项目名称:nest,代码行数:8,代码来源:router-response-controller.ts

示例3: create

 public create(
   port: number,
   options?: any & { namespace?: string; server?: any },
 ): any {
   if (!options) {
     return this.createIOServer(port);
   }
   const { namespace, server, ...opt } = options;
   return server && isFunction(server.of)
     ? server.of(namespace)
     : namespace
       ? this.createIOServer(port, opt).of(namespace)
       : this.createIOServer(port, opt);
 }
开发者ID:SARAVANA1501,项目名称:nest,代码行数:14,代码来源:io-adapter.ts

示例4: mapPayload

 public mapPayload(payload: any): { data: any; ack?: Function } {
   if (!Array.isArray(payload)) {
     return { data: payload };
   }
   const lastElement = payload[payload.length - 1];
   const isAck = isFunction(lastElement);
   if (isAck) {
     const size = payload.length - 1;
     return {
       data: size === 1 ? payload[0] : payload.slice(0, size),
       ack: lastElement,
     };
   }
   return { data: payload };
 }
开发者ID:SARAVANA1501,项目名称:nest,代码行数:15,代码来源:io-adapter.ts

示例5: String

 public *scanForServerHooks(instance: NestGateway): IterableIterator<string> {
   for (const propertyKey in instance) {
     if (isFunction(propertyKey)) {
       continue;
     }
     const property = String(propertyKey);
     const isServer = Reflect.getMetadata(
       GATEWAY_SERVER_METADATA,
       instance,
       property,
     );
     if (!isUndefined(isServer)) {
       yield property;
     }
   }
 }
开发者ID:SARAVANA1501,项目名称:nest,代码行数:16,代码来源:gateway-metadata-explorer.ts

示例6: UndefinedDependencyException

 public async resolveSingleParam<T>(
   wrapper: InstanceWrapper<T>,
   param: Type<any> | string | symbol | any,
   { index, length }: { index: number; length: number },
   module: Module,
 ) {
   if (isUndefined(param)) {
     throw new UndefinedDependencyException(wrapper.name, index, length);
   }
   const token = this.resolveParamToken(wrapper, param);
   return await this.resolveComponentInstance<T>(
     module,
     isFunction(token) ? (token as Type<any>).name : token,
     { index, length },
     wrapper,
   );
 }
开发者ID:a1r0,项目名称:nest,代码行数:17,代码来源:injector.ts

示例7: UndefinedDependencyException

 public async resolveSingleParam<T>(
   wrapper: InstanceWrapper<T>,
   param: Type<any> | string | symbol | any,
   dependencyContext: InjectorDependencyContext,
   module: Module,
 ) {
   if (isUndefined(param)) {
     throw new UndefinedDependencyException(wrapper.name, dependencyContext, module);
   }
   const token = this.resolveParamToken(wrapper, param);
   return this.resolveComponentInstance<T>(
     module,
     isFunction(token) ? (token as Type<any>).name : token,
     dependencyContext,
     wrapper,
   );
 }
开发者ID:SARAVANA1501,项目名称:nest,代码行数:17,代码来源:injector.ts

示例8: Map

 protected findInstanceByPrototypeOrToken<TInput = any, TResult = TInput>(
   metatypeOrToken: Type<TInput> | string | symbol,
   contextModule: Partial<Module>,
 ): TResult {
   const dependencies = new Map([
     ...contextModule.components,
     ...contextModule.routes,
     ...contextModule.injectables,
   ]);
   const name = isFunction(metatypeOrToken)
     ? (metatypeOrToken as any).name
     : metatypeOrToken;
   const instanceWrapper = dependencies.get(name);
   if (!instanceWrapper) {
     throw new UnknownElementException();
   }
   return (instanceWrapper as InstanceWrapper<any>).instance;
 }
开发者ID:timokae,项目名称:nest,代码行数:18,代码来源:module-ref.ts

示例9: String

  public *scanForClientHooks(
    instance: Controller,
  ): IterableIterator<ClientProperties> {
    for (const propertyKey in instance) {
      if (isFunction(propertyKey)) continue;

      const property = String(propertyKey);
      const isClient = Reflect.getMetadata(CLIENT_METADATA, instance, property);
      if (isUndefined(isClient)) continue;

      const metadata = Reflect.getMetadata(
        CLIENT_CONFIGURATION_METADATA,
        instance,
        property,
      );
      yield { property, metadata };
    }
  }
开发者ID:SARAVANA1501,项目名称:nest,代码行数:18,代码来源:listener-metadata-explorer.ts

示例10: isFunction

 (interceptor: NestInterceptor) =>
   interceptor && isFunction(interceptor.intercept),
开发者ID:timokae,项目名称:nest,代码行数:2,代码来源:interceptors-context-creator.ts


注:本文中的@nestjs/common/utils/shared.utils.isFunction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。