Class Validator

Hierarchy

  • Pick<Validators, keyof Validators>
    • Validator

Constructors

  • Parameters

    Returns Validator

Properties

contains: ((str: string, seed: any, options?: ContainsOptions) => boolean)

Type declaration

    • (str: string, seed: any, options?: ContainsOptions): boolean
    • Check if the string contains the seed.

      Parameters

      • str: string
      • seed: any

        Seed

      • Optional options: ContainsOptions

      Returns boolean

entity: Entity

Entity to get the value of the attribute

equals: ((str: string, comparison: string) => boolean)

Type declaration

    • (str: string, comparison: string): boolean
    • Check if the string matches the comparison.

      Parameters

      • str: string
      • comparison: string

        String to compare

      Returns boolean

errors: string[] = []

The cached errors of the validation

ibanLocales: ("BE" | "AD" | "AE" | "AL" | "AT" | "AZ" | "BA" | "BG" | "BH" | "BR" | "BY" | "CH" | "CR" | "CY" | "CZ" | "DE" | "DK" | "DO" | "EE" | "EG" | "ES" | "FI" | "FO" | "FR" | "GB" | "GE" | "GI" | "GL" | "GR" | "GT" | "HR" | "HU" | "IE" | "IL" | "IQ" | "IR" | "IS" | "IT" | "JO" | "KW" | "KZ" | "LB" | "LC" | "LI" | "LT" | "LU" | "LV" | "MC" | "MD" | "ME" | "MK" | "MR" | "MT" | "MU" | "MZ" | "NL" | "NO" | "PK" | "PL" | "PS" | "PT" | "QA" | "RO" | "RS" | "SA" | "SC" | "SE" | "SI" | "SK" | "SM" | "SV" | "TL" | "TN" | "TR" | "UA" | "VA" | "VG" | "XK")[]
isAfter: ((str: string, date?: string) => boolean)

Type declaration

    • (str: string, date?: string): boolean
    • Check if the string is a date that's after the specified date.

      Parameters

      • str: string
      • Optional date: string

        Date string (defaults to now)

      Returns boolean

isAlpha: ((str: string, locale?: AlphaLocale, options?: IsAlphaOptions) => boolean)

Type declaration

    • (str: string, locale?: AlphaLocale, options?: IsAlphaOptions): boolean
    • Check if the string contains only letters (a-zA-Z).

      Parameters

      • str: string
      • Optional locale: AlphaLocale

        AlphaLocale

      • Optional options: IsAlphaOptions

        IsAlphaOptions

      Returns boolean

isAlphaLocales: AlphaLocale[]
isAlphanumeric: ((str: string, locale?: AlphanumericLocale, options?: IsAlphanumericOptions) => boolean)

Type declaration

    • (str: string, locale?: AlphanumericLocale, options?: IsAlphanumericOptions): boolean
    • Check if the string contains only letters and numbers.

      Parameters

      • str: string
      • Optional locale: AlphanumericLocale

        AlphanumericLocale

      • Optional options: IsAlphanumericOptions

        IsAlphanumericOptions

      Returns boolean

isAlphanumericLocales: AlphanumericLocale[]
isAscii: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string contains ASCII chars only.

      Parameters

      • str: string

      Returns boolean

isBIC: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if a string is a BIC (Bank Identification Code) or SWIFT code.

      Parameters

      • str: string

      Returns boolean

isBase32: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if a string is base32 encoded.

      Parameters

      • str: string

      Returns boolean

isBase58: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • check if a string is base58 encoded

      Parameters

      • str: string

      Returns boolean

isBase64: ((str: string, options?: IsBase64Options) => boolean)

Type declaration

    • (str: string, options?: IsBase64Options): boolean
    • Check if a string is base64 encoded.

      Parameters

      • str: string
      • Optional options: IsBase64Options

        Options

      Returns boolean

isBefore: ((str: string, date?: string) => boolean)

Type declaration

    • (str: string, date?: string): boolean
    • Check if the string is a date that's before the specified date.

      Parameters

      • str: string
      • Optional date: string

        Date string (defaults to now)

      Returns boolean

isBoolean: ((str: string, options?: Options) => boolean)

Type declaration

    • (str: string, options?: Options): boolean
    • check if a string is a boolean.

      Parameters

      • str: string
      • Optional options: Options

      Returns boolean

isBtcAddress: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a valid BTC address.

      Parameters

      • str: string

      Returns boolean

isByteLength: ((str: string, options?: IsByteLengthOptions) => boolean)

Type declaration

    • (str: string, options?: IsByteLengthOptions): boolean
    • Check if the string's length (in UTF-8 bytes) falls in a range.

      Parameters

      • str: string
      • Optional options: IsByteLengthOptions

        Options

      Returns boolean

isCreditCard: ((str: string, options?: IsCreditCardOptions) => boolean)

Type declaration

    • (str: string, options?: IsCreditCardOptions): boolean
    • Check if the string is a credit card.

      Parameters

      • str: string
      • Optional options: IsCreditCardOptions

      Returns boolean

isCurrency: ((str: string, options?: IsCurrencyOptions) => boolean)

Type declaration

    • (str: string, options?: IsCurrencyOptions): boolean
    • Check if the string is a valid currency amount.

      Parameters

      • str: string
      • Optional options: IsCurrencyOptions

        Options

      Returns boolean

isDataURI: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a data uri format.

      Parameters

      • str: string

      Returns boolean

isDate: ((str: string, options?: IsDateOptions) => boolean)

Type declaration

    • (str: string, options?: IsDateOptions): boolean
    • Check if the string is a valid date.

      Parameters

      • str: string
      • Optional options: IsDateOptions

      Returns boolean

isDecimal: ((str: string, options?: IsDecimalOptions) => boolean)

Type declaration

    • (str: string, options?: IsDecimalOptions): boolean
    • Check if the string represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0 etc.

      Parameters

      • str: string
      • Optional options: IsDecimalOptions

        Options

      Returns boolean

isDivisibleBy: ((str: string, number: number) => boolean)

Type declaration

    • (str: string, number: number): boolean
    • Check if the string is a number that's divisible by another.

      Parameters

      • str: string
      • number: number

        Divider number

      Returns boolean

isEAN: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is an EAN (European Article Number).

      Parameters

      • str: string

      Returns boolean

isEmail: ((str: string, options?: IsEmailOptions) => boolean)

Type declaration

    • (str: string, options?: IsEmailOptions): boolean
    • Check if the string is an email.

      Parameters

      • str: string
      • Optional options: IsEmailOptions

        Options

      Returns boolean

isEmpty: ((str: string, options?: IsEmptyOptions) => boolean)

Type declaration

    • (str: string, options?: IsEmptyOptions): boolean
    • Check if the string has a length of zero.

      Parameters

      • str: string
      • Optional options: IsEmptyOptions

        Options

      Returns boolean

isEthereumAddress: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is an Ethereum address using basic regex. Does not validate address checksums.

      Parameters

      • str: string

      Returns boolean

isFQDN: ((str: string, options?: IsFQDNOptions) => boolean)

Type declaration

    • (str: string, options?: IsFQDNOptions): boolean
    • Check if the string is a fully qualified domain name (e.g. domain.com).

      Parameters

      • str: string
      • Optional options: IsFQDNOptions

        Options

      Returns boolean

isFloat: ((str: string, options?: IsFloatOptions) => boolean)

Type declaration

    • (str: string, options?: IsFloatOptions): boolean
    • Check if the string is a float.

      Parameters

      • str: string
      • Optional options: IsFloatOptions

        Options

      Returns boolean

isFloatLocales: FloatLocale[]
isFullWidth: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string contains any full-width chars.

      Parameters

      • str: string

      Returns boolean

isHSL: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is an HSL (hue, saturation, lightness, optional alpha) color based on CSS Colors Level 4 specification. Comma-separated format supported. Space-separated format supported with the exception of a few edge cases (ex: hsl(200grad+.1%62%/1)).

      Parameters

      • str: string

      Returns boolean

isHalfWidth: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string contains any half-width chars.

      Parameters

      • str: string

      Returns boolean

isHash: ((str: string, algorithm: HashAlgorithm) => boolean)

Type declaration

    • (str: string, algorithm: HashAlgorithm): boolean
    • Check if the string is a hash of type algorithm.

      Parameters

      • str: string
      • algorithm: HashAlgorithm

        HashAlgorithm

      Returns boolean

isHexColor: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a hexadecimal color.

      Parameters

      • str: string

      Returns boolean

isHexadecimal: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a hexadecimal number.

      Parameters

      • str: string

      Returns boolean

isIBAN: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if a string is a IBAN (International Bank Account Number).

      Parameters

      • str: string

      Returns boolean

isIMEI: ((str: string, options?: IsIMEIOptions) => boolean)

Type declaration

    • (str: string, options?: IsIMEIOptions): boolean
    • Check if the string is a valid IMEI. Non-hyphenated (###############) only is supported by default. Use the options param to enable hyphenated (##-######-######-#) support.

      Parameters

      • str: string
      • Optional options: IsIMEIOptions

        Options

      Returns boolean

isIP: ((str: string, version?: IPVersion) => boolean)

Type declaration

    • (str: string, version?: IPVersion): boolean
    • Check if the string is an IP (version 4 or 6).

      Parameters

      • str: string
      • Optional version: IPVersion

        IP Version

      Returns boolean

isIPRange: ((str: string, version?: IPVersion) => boolean)

Type declaration

    • (str: string, version?: IPVersion): boolean
    • Check if the string is an IP Range (version 4 or 6).

      Parameters

      • str: string
      • Optional version: IPVersion

      Returns boolean

isISBN: ((str: string, version?: ISBNVersion) => boolean)

Type declaration

    • (str: string, version?: ISBNVersion): boolean
    • Check if the string is an ISBN (version 10 or 13).

      Parameters

      • str: string
      • Optional version: ISBNVersion

        ISBN Version

      Returns boolean

isISIN: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is an ISIN (stock/security identifier).

      Parameters

      • str: string

      Returns boolean

isISO31661Alpha2: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a valid ISO 3166-1 alpha-2 officially assigned country code.

      Parameters

      • str: string

      Returns boolean

isISO31661Alpha3: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a valid ISO 3166-1 alpha-3 officially assigned country code.

      Parameters

      • str: string

      Returns boolean

isISO4217: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a valid ISO 4217 officially assigned currency code.

      Parameters

      • str: string

      Returns boolean

isISO8601: ((str: string, options?: IsISO8601Options) => boolean)

Type declaration

    • (str: string, options?: IsISO8601Options): boolean
    • Check if the string is a valid ISO 8601 date.

      Parameters

      • str: string
      • Optional options: IsISO8601Options

        Options

      Returns boolean

isISRC: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a ISRC.

      Parameters

      • str: string

      Returns boolean

isISSN: ((str: string, options?: IsISSNOptions) => boolean)

Type declaration

    • (str: string, options?: IsISSNOptions): boolean
    • Check if the string is an ISSN.

      Parameters

      • str: string
      • Optional options: IsISSNOptions

        Options

      Returns boolean

isIdentityCard: ((str: string, locale?: "any" | IdentityCardLocale) => boolean)

Type declaration

    • (str: string, locale?: "any" | IdentityCardLocale): boolean
    • Check if the string is a valid identity card code.

      Parameters

      • str: string
      • Optional locale: "any" | IdentityCardLocale

        IdentityCardLocale

      Returns boolean

isIn: ((str: string, values: any[]) => boolean)

Type declaration

    • (str: string, values: any[]): boolean
    • Check if the string is in a array of allowed values.

      Parameters

      • str: string
      • values: any[]

        Allowed values.

      Returns boolean

isInt: ((str: string, options?: IsIntOptions) => boolean)

Type declaration

    • (str: string, options?: IsIntOptions): boolean
    • Check if the string is an integer.

      Parameters

      • str: string
      • Optional options: IsIntOptions

        Options

      Returns boolean

isJSON: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is valid JSON (note: uses JSON.parse).

      Parameters

      • str: string

      Returns boolean

isJWT: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is valid JWT token.

      Parameters

      • str: string

      Returns boolean

isLatLong: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a valid latitude-longitude coordinate in the format:

      lat,long or lat, long.

      Parameters

      • str: string

      Returns boolean

isLength: ((str: string, options?: IsLengthOptions) => boolean)

Type declaration

    • (str: string, options?: IsLengthOptions): boolean
    • Check if the string's length falls in a range.

      Note: this function takes into account surrogate pairs.

      Parameters

      • str: string
      • Optional options: IsLengthOptions

        Options

      Returns boolean

isLocale: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a locale.

      Parameters

      • str: string

      Returns boolean

isLowercase: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is lowercase.

      Parameters

      • str: string

      Returns boolean

isMACAddress: ((str: string, options?: IsMACAddressOptions) => boolean)

Type declaration

    • (str: string, options?: IsMACAddressOptions): boolean
    • Check if the string is a MAC address.

      Parameters

      • str: string
      • Optional options: IsMACAddressOptions

        Options

      Returns boolean

isMD5: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a MD5 hash.

      Parameters

      • str: string

      Returns boolean

isMagnetURI: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a magnet uri format.

      Parameters

      • str: string

      Returns boolean

isMimeType: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string matches to a valid MIME type format.

      Parameters

      • str: string

      Returns boolean

isMobilePhone: ((str: string, locale?: "any" | MobilePhoneLocale | MobilePhoneLocale[], options?: IsMobilePhoneOptions) => boolean)

Type declaration

    • (str: string, locale?: "any" | MobilePhoneLocale | MobilePhoneLocale[], options?: IsMobilePhoneOptions): boolean
    • Check if the string is a mobile phone number.

      Parameters

      • str: string
      • Optional locale: "any" | MobilePhoneLocale | MobilePhoneLocale[]

        MobilePhoneLocale(s)

      • Optional options: IsMobilePhoneOptions

        Options

      Returns boolean

isMobilePhoneLocales: MobilePhoneLocale[]
isMongoId: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a valid hex-encoded representation of a MongoDB ObjectId.

      Parameters

      • str: string

      Returns boolean

isMultibyte: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string contains one or more multibyte chars.

      Parameters

      • str: string

      Returns boolean

isNumeric: ((str: string, options?: IsNumericOptions) => boolean)

Type declaration

    • (str: string, options?: IsNumericOptions): boolean
    • Check if the string contains only numbers.

      Parameters

      • str: string
      • Optional options: IsNumericOptions

        Options

      Returns boolean

isOctal: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a valid octal number.

      Parameters

      • str: string

      Returns boolean

isPassportNumber: ((str: string, countryCode?: string) => boolean)

Type declaration

    • (str: string, countryCode?: string): boolean
    • Check if the string is a valid passport number relative to a specific country code.

      Parameters

      • str: string
      • Optional countryCode: string

        Country code

      Returns boolean

isPort: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a valid port number.

      Parameters

      • str: string

      Returns boolean

isPostalCode: ((str: string, locale: "any" | PostalCodeLocale) => boolean)

Type declaration

    • (str: string, locale: "any" | PostalCodeLocale): boolean
    • Check if the string is a postal code

      Parameters

      • str: string
      • locale: "any" | PostalCodeLocale

        PostalCodeLocale

      Returns boolean

isPostalCodeLocales: PostalCodeLocale[]
isRFC3339: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a valid RFC 3339 date.

      Parameters

      • str: string

      Returns boolean

isRgbColor: ((str: string, includePercentValues?: boolean) => boolean)

Type declaration

    • (str: string, includePercentValues?: boolean): boolean
    • Check if the string is a rgb or rgba color.

      Parameters

      • str: string
      • Optional includePercentValues: boolean

        If you don't want to allow to set rgb or rgba values with percents, like rgb(5%,5%,5%), or rgba(90%,90%,90%,.3), then set it to false. (defaults to true)

      Returns boolean

isSemVer: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is a Semantic Versioning Specification (SemVer).

      Parameters

      • str: string

      Returns boolean

isSlug: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is of type slug.

      Parameters

      • str: string

      Returns boolean

isStrongPassword: {
    (str: string, options?: StrongPasswordOptions & {
        returnScore?: false;
    }): boolean;
    (str: string, options: StrongPasswordOptions & {
        returnScore: true;
    }): number;
}

Type declaration

    • (str: string, options?: StrongPasswordOptions & {
          returnScore?: false;
      }): boolean
    • Parameters

      • str: string
      • Optional options: StrongPasswordOptions & {
            returnScore?: false;
        }

      Returns boolean

    • (str: string, options: StrongPasswordOptions & {
          returnScore: true;
      }): number
    • Parameters

      • str: string
      • options: StrongPasswordOptions & {
            returnScore: true;
        }

      Returns number

isSurrogatePair: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string contains any surrogate pairs chars.

      Parameters

      • str: string

      Returns boolean

isTaxID: ((str: string, locale?: string) => boolean)

Type declaration

    • (str: string, locale?: string): boolean
    • Validator function Return true if the passed string is a valid tax identification number for the specified locale. Throw an error exception if the locale is not supported.

      Parameters

      • str: string
      • Optional locale: string

      Returns boolean

isTime: ((str: string, options?: IsTimeOptions) => boolean)

Type declaration

    • (str: string, options?: IsTimeOptions): boolean
    • Check if the string is a valid time.

      Parameters

      • str: string
      • Optional options: IsTimeOptions

      Returns boolean

isURL: ((str: string, options?: IsURLOptions) => boolean)

Type declaration

    • (str: string, options?: IsURLOptions): boolean
    • Check if the string is an URL.

      Parameters

      • str: string
      • Optional options: IsURLOptions

        Options

      Returns boolean

isUUID: ((str: string, version?: UUIDVersion) => boolean)

Type declaration

    • (str: string, version?: UUIDVersion): boolean
    • Check if the string is a UUID (version 1, 2, 3, 4 or 5).

      Parameters

      • str: string
      • Optional version: UUIDVersion

        UUID version

      Returns boolean

isUppercase: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string is uppercase.

      Parameters

      • str: string

      Returns boolean

isVAT: ((str: string, countryCode: string) => boolean)

Type declaration

    • (str: string, countryCode: string): boolean
    • Checks that the string is a [valid VAT number

      Parameters

      • str: string
      • countryCode: string

      Returns boolean

isVariableWidth: ((str: string) => boolean)

Type declaration

    • (str: string): boolean
    • Check if the string contains a mixture of full and half-width chars.

      Parameters

      • str: string

      Returns boolean

isWhitelisted: ((str: string, chars: string | string[]) => boolean)

Type declaration

    • (str: string, chars: string | string[]): boolean
    • Checks characters if they appear in the whitelist.

      Parameters

      • str: string
      • chars: string | string[]

        whitelist

      Returns boolean

key: string

Name of the attribute

matches: {
    (str: string, pattern: RegExp): boolean;
    (str: string, pattern: string, modifiers?: string): boolean;
}

Type declaration

    • (str: string, pattern: RegExp): boolean
    • Check if string matches the pattern.

      Parameters

      • str: string
      • pattern: RegExp

        /foo/i

      Returns boolean

    • (str: string, pattern: string, modifiers?: string): boolean
    • Check if string matches the pattern.

      Parameters

      • str: string
      • pattern: string

        'foo'

      • Optional modifiers: string

        'i'

      Returns boolean

Accessors

  • get isValid(): boolean
  • Checks if the attribute is valid

    Returns

    Returns boolean

  • get value(): any
  • Gets the value of the attribute

    Returns

    Value

    Returns any

Methods

  • Parameters

    • method: "toString" | "trim" | "matches" | "contains" | "equals" | "version" | "blacklist" | "escape" | "unescape" | "ltrim" | "normalizeEmail" | "rtrim" | "stripLow" | "toBoolean" | "toDate" | "toFloat" | "toInt" | "whitelist" | "isAfter" | "isAlpha" | "isAlphanumeric" | "isAscii" | "isBase32" | "isBase58" | "isBase64" | "isBefore" | "isBIC" | "isByteLength" | "isCreditCard" | "isCurrency" | "isEthereumAddress" | "isBtcAddress" | "isDataURI" | "isDate" | "isDecimal" | "isDivisibleBy" | "isEmpty" | "isFloat" | "isFullWidth" | "isHalfWidth" | "isHash" | "isHexadecimal" | "isHexColor" | "isHSL" | "isRgbColor" | "isIdentityCard" | "isIMEI" | "isIn" | "isInt" | "isIP" | "isIPRange" | "isISBN" | "isEAN" | "isISIN" | "isISO31661Alpha3" | "isISO8601" | "isISSN" | "isISRC" | "isRFC3339" | "isJSON" | "isJWT" | "isLatLong" | "isLength" | "isLocale" | "isLowercase" | "isMACAddress" | "isMagnetURI" | "isMD5" | "isMimeType" | "isMobilePhone" | "isMongoId" | "isMultibyte" | "isNumeric" | "isOctal" | "isPassportNumber" | "isPort" | "isPostalCode" | "isSemVer" | "isStrongPassword" | "isSurrogatePair" | "isTime" | "isUppercase" | "isUUID" | "isVariableWidth" | "isVAT" | "isWhitelisted" | "isSlug" | "isAlphaLocales" | "isAlphanumericLocales" | "isIBAN" | "ibanLocales" | "isBoolean" | "isEmail" | "isFloatLocales" | "isFQDN" | "isISO31661Alpha2" | "isISO4217" | "isMobilePhoneLocales" | "isPostalCodeLocales" | "isURL" | "isTaxID"
    • errorMessage: null | string
    • argumentList: any[]

    Returns Validator

  • Executes the given validation function to validate the value.

    The value will be passed as the first parameter to the validation function and the library https://github.com/chriso/validator.js as the second one. If the function returns true the value is valid, otherwise it's invalid.

    Returns

    Parameters

    • fn: Function

      will be used to validate the value

    Returns Validator

  • Executes the given validation function to validate the value.

    The value will be passed as the first parameter to the validation function and the library https://github.com/chriso/validator.js as the second one. If the function returns true the value is valid, otherwise it's invalid.

    Returns

    Parameters

    • error: string

      The error message which will be used if the value is invalid

    • fn: Function

      will be used to validate the value

    Returns Validator

  • Returns {
        errors: string[];
        isValid: boolean;
    }

    • errors: string[]
    • isValid: boolean
  • Returns string | Date

  • Compiles the given validation code for the managedType

    Returns

    the parsed validation function

    Parameters

    • managedType: ManagedType<any>

      The managedType of the code

    • validationCode: string

      The validation code

    Returns Function

Generated using TypeDoc