當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。