Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

Functions

IfValid

  • IfValid(target: string, validationOptions?: ValidationOptions): (object: any, propertyName: string) => void
  • The IfValid decorator checks whether the target argument is a valid property before proceeding with the validation of the property decorated.

    Example

    The property checkMe is not valid and so the @IsDefined annotation will not be invoked for the p1 property:

    class IfValidNotTest1 {
    @IsDefined()
    checkMe: any = null; //Property not valid

    @IsDefined()
    @IfValid("checkMe")
    p1: any = null;
    }

    Parameters

    • target: string

      The name of the property that should be valid.

    • Optional validationOptions: ValidationOptions

      The validation options

    Returns (object: any, propertyName: string) => void

      • (object: any, propertyName: string): void
      • Parameters

        • object: any
        • propertyName: string

        Returns void

Generated using TypeDoc