How to use the @nestjs/common/utils/shared.utils.isFunction function in @nestjs/common

To help you get started, weโ€™ve selected a few @nestjs/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nestjs / nest / bundle / core / router / router-response-controller.js View on Github external
async transformToResult(resultOrDeffered) {
        if (resultOrDeffered && shared_utils_1.isFunction(resultOrDeffered.subscribe)) {
            return await resultOrDeffered.toPromise();
        }
        return resultOrDeffered;
    }
    getStatusByMethod(requestMethod) {
github nestjs / nest / src / websockets / adapters / io-adapter.ts View on Github external
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);
  }
github nestjs / nest / packages / core / injector / module.ts View on Github external
public async create(type: Type): Promise {
        if (!(type && isFunction(type) && type.prototype)) {
          throw new InvalidClassException(type);
        }
        return this.instantiateClass(type, self);
      }
    };
github nestjs / nest / packages / websockets / adapters / ws-adapter.ts View on Github external
public close(server: any) {
    server && isFunction(server.close) && server.close();
  }
github nestjs / nest / lib / core / nest-factory.js View on Github external
return (receiver, prop) => {
            if (!(prop in receiver))
                return;
            if (shared_utils_1.isFunction(receiver[prop])) {
                return (...args) => {
                    let result;
                    exceptions_zone_1.ExceptionsZone.run(() => {
                        result = receiver[prop](...args);
                    });
                    return result;
                };
            }
            return receiver[prop];
        };
    }
github nestjs / nest / bundle / websockets / web-sockets-controller.js View on Github external
async pickResult(defferedResult) {
        const result = await defferedResult;
        if (result && shared_utils_1.isFunction(result.subscribe)) {
            return result;
        }
        if (result instanceof Promise) {
            return rxjs_1.from(result);
        }
        return rxjs_1.of(result);
    }
    hookServerToProperties(instance, server) {
github nestjs / nest / src / core / guards / guards-context-creator.ts View on Github external
            .filter((guard) => guard && guard.canActivate && isFunction(guard.canActivate))
            .toArray() as R;
github nestjs / nest / src / core / router / router-response-controller.ts View on Github external
public async transformToResult(resultOrDeffered) {
    if (resultOrDeffered instanceof Promise) {
      return await resultOrDeffered;
    } else if (resultOrDeffered && isFunction(resultOrDeffered.subscribe)) {
      return await resultOrDeffered.toPromise();
    }
    return resultOrDeffered;
  }
github nestjs / nest / packages / core / pipes / pipes-context-creator.ts View on Github external
      .filter(pipe => pipe && pipe.transform && isFunction(pipe.transform))
      .map(pipe => pipe.transform.bind(pipe))
github nestjs / nest / packages / websockets / context / ws-proxy.ts View on Github external
isObservable(result: any): boolean {
    return result && isFunction(result.subscribe);
  }
}