How to use the @tsed/core.Metadata.get function in @tsed/core

To help you get started, we’ve selected a few @tsed/core 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 TypedProject / ts-express-decorators / test / units / core / class / Metadata.spec.ts View on Github external
it("should get meta on a class", () => {
      expect(Metadata.get("metadatakey1", Test)).to.equal("test1");
    });
github TypedProject / ts-express-decorators / packages / common / src / mvc / registries / ParamRegistry.ts View on Github external
static getParams(target: Type, propertyKey: string | symbol): ParamMetadata[] {
    return Metadata.has(PARAM_METADATA, target, propertyKey) ? Metadata.get(PARAM_METADATA, target, propertyKey) : [];
  }
github TypedProject / ts-express-decorators / packages / common / src / mvc / models / HandlerMetadata.ts View on Github external
constructor(options: IHandlerOptions) {
    const {target, token, method, type = HandlerType.FUNCTION} = options;

    this.type = type;
    this.handler = method ? target.prototype[method] : target;

    if (method) {
      this.target = target;
      this.token = token!;
      this.methodClassName = method;
      this.method = method;
      this.hasNextFunction = this.hasParamType(ParamTypes.NEXT_FN);
      this.hasErrorParam = this.hasParamType(ParamTypes.ERR);
      this.injectable = (Metadata.get(PARAM_METADATA, target, method) || []).length > 0;
    }

    if (!this.injectable) {
      this.hasErrorParam = this.handler.length === 4;
      this.hasNextFunction = this.handler.length >= 3;
    }
  }
github TypedProject / ts-express-decorators / packages / common / src / converters / services / ConverterService.ts View on Github external
getConverter(targetType: any): IConverter | undefined {
    if (Metadata.has(CONVERTER, targetType)) {
      const converter = Metadata.get(CONVERTER, targetType);

      if (converter) {
        return this.injectorService.get(converter);
      }
    }
  }