class-validator

  • Version 0.14.1
  • Published
  • 5.12 MB
  • 3 dependencies
  • MIT license

Install

npm i class-validator
yarn add class-validator
pnpm add class-validator

Overview

Decorator-based property validation for classes.

Index

Variables

Functions

Classes

Interfaces

Type Aliases

Variables

variable ARRAY_CONTAINS

const ARRAY_CONTAINS: string;

    variable ARRAY_MAX_SIZE

    const ARRAY_MAX_SIZE: string;

      variable ARRAY_MIN_SIZE

      const ARRAY_MIN_SIZE: string;

        variable ARRAY_NOT_CONTAINS

        const ARRAY_NOT_CONTAINS: string;

          variable ARRAY_NOT_EMPTY

          const ARRAY_NOT_EMPTY: string;

            variable ARRAY_UNIQUE

            const ARRAY_UNIQUE: string;

              variable CONTAINS

              const CONTAINS: string;

                variable EQUALS

                const EQUALS: string;

                  variable IS_ALPHA

                  const IS_ALPHA: string;

                    variable IS_ALPHANUMERIC

                    const IS_ALPHANUMERIC: string;

                      variable IS_ARRAY

                      const IS_ARRAY: string;

                        variable IS_ASCII

                        const IS_ASCII: string;

                          variable IS_BASE32

                          const IS_BASE32: string;

                            variable IS_BASE58

                            const IS_BASE58: string;

                              variable IS_BASE64

                              const IS_BASE64: string;

                                variable IS_BIC

                                const IS_BIC: string;

                                  variable IS_BOOLEAN

                                  const IS_BOOLEAN: string;

                                    variable IS_BOOLEAN_STRING

                                    const IS_BOOLEAN_STRING: string;

                                      variable IS_BTC_ADDRESS

                                      const IS_BTC_ADDRESS: string;

                                        variable IS_BYTE_LENGTH

                                        const IS_BYTE_LENGTH: string;

                                          variable IS_CREDIT_CARD

                                          const IS_CREDIT_CARD: string;

                                            variable IS_CURRENCY

                                            const IS_CURRENCY: string;

                                              variable IS_DATA_URI

                                              const IS_DATA_URI: string;

                                                variable IS_DATE

                                                const IS_DATE: string;

                                                  variable IS_DATE_STRING

                                                  const IS_DATE_STRING: string;

                                                    variable IS_DECIMAL

                                                    const IS_DECIMAL: string;

                                                      variable IS_DEFINED

                                                      const IS_DEFINED: string;

                                                        variable IS_DIVISIBLE_BY

                                                        const IS_DIVISIBLE_BY: string;

                                                          variable IS_EAN

                                                          const IS_EAN: string;

                                                            variable IS_EMAIL

                                                            const IS_EMAIL: string;

                                                              variable IS_EMPTY

                                                              const IS_EMPTY: string;

                                                                variable IS_ENUM

                                                                const IS_ENUM: string;

                                                                  variable IS_ETHEREUM_ADDRESS

                                                                  const IS_ETHEREUM_ADDRESS: string;

                                                                    variable IS_FIREBASE_PUSH_ID

                                                                    const IS_FIREBASE_PUSH_ID: string;

                                                                      variable IS_FQDN

                                                                      const IS_FQDN: string;

                                                                        variable IS_FULL_WIDTH

                                                                        const IS_FULL_WIDTH: string;

                                                                          variable IS_HALF_WIDTH

                                                                          const IS_HALF_WIDTH: string;

                                                                            variable IS_HASH

                                                                            const IS_HASH: string;

                                                                              variable IS_HEX_COLOR

                                                                              const IS_HEX_COLOR: string;

                                                                                variable IS_HEXADECIMAL

                                                                                const IS_HEXADECIMAL: string;

                                                                                  variable IS_HSL

                                                                                  const IS_HSL: string;

                                                                                    variable IS_IBAN

                                                                                    const IS_IBAN: string;

                                                                                      variable IS_IDENTITY_CARD

                                                                                      const IS_IDENTITY_CARD: string;

                                                                                        variable IS_IN

                                                                                        const IS_IN: string;

                                                                                          variable IS_INSTANCE

                                                                                          const IS_INSTANCE: string;

                                                                                            variable IS_INT

                                                                                            const IS_INT: string;

                                                                                              variable IS_IP

                                                                                              const IS_IP: string;

                                                                                                variable IS_ISBN

                                                                                                const IS_ISBN: string;

                                                                                                  variable IS_ISIN

                                                                                                  const IS_ISIN: string;

                                                                                                    variable IS_ISO31661_ALPHA_2

                                                                                                    const IS_ISO31661_ALPHA_2: string;

                                                                                                      variable IS_ISO31661_ALPHA_3

                                                                                                      const IS_ISO31661_ALPHA_3: string;

                                                                                                        variable IS_ISO4217_CURRENCY_CODE

                                                                                                        const IS_ISO4217_CURRENCY_CODE: string;

                                                                                                          variable IS_ISO8601

                                                                                                          const IS_ISO8601: string;

                                                                                                            variable IS_ISRC

                                                                                                            const IS_ISRC: string;

                                                                                                              variable IS_ISSN

                                                                                                              const IS_ISSN: string;

                                                                                                                variable IS_JSON

                                                                                                                const IS_JSON: string;

                                                                                                                  variable IS_JWT

                                                                                                                  const IS_JWT: string;

                                                                                                                    variable IS_LATITUDE

                                                                                                                    const IS_LATITUDE: string;

                                                                                                                      variable IS_LATLONG

                                                                                                                      const IS_LATLONG: string;

                                                                                                                        variable IS_LENGTH

                                                                                                                        const IS_LENGTH: string;

                                                                                                                          variable IS_LOCALE

                                                                                                                          const IS_LOCALE: string;

                                                                                                                            variable IS_LONGITUDE

                                                                                                                            const IS_LONGITUDE: string;

                                                                                                                              variable IS_LOWERCASE

                                                                                                                              const IS_LOWERCASE: string;

                                                                                                                                variable IS_MAC_ADDRESS

                                                                                                                                const IS_MAC_ADDRESS: string;

                                                                                                                                  variable IS_MAGNET_URI

                                                                                                                                  const IS_MAGNET_URI: string;

                                                                                                                                    variable IS_MILITARY_TIME

                                                                                                                                    const IS_MILITARY_TIME: string;

                                                                                                                                      variable IS_MIME_TYPE

                                                                                                                                      const IS_MIME_TYPE: string;

                                                                                                                                        variable IS_MOBILE_PHONE

                                                                                                                                        const IS_MOBILE_PHONE: string;

                                                                                                                                          variable IS_MONGO_ID

                                                                                                                                          const IS_MONGO_ID: string;

                                                                                                                                            variable IS_MULTIBYTE

                                                                                                                                            const IS_MULTIBYTE: string;

                                                                                                                                              variable IS_NEGATIVE

                                                                                                                                              const IS_NEGATIVE: string;

                                                                                                                                                variable IS_NOT_EMPTY

                                                                                                                                                const IS_NOT_EMPTY: string;

                                                                                                                                                  variable IS_NOT_EMPTY_OBJECT

                                                                                                                                                  const IS_NOT_EMPTY_OBJECT: string;

                                                                                                                                                    variable IS_NOT_IN

                                                                                                                                                    const IS_NOT_IN: string;

                                                                                                                                                      variable IS_NUMBER

                                                                                                                                                      const IS_NUMBER: string;

                                                                                                                                                        variable IS_NUMBER_STRING

                                                                                                                                                        const IS_NUMBER_STRING: string;

                                                                                                                                                          variable IS_OBJECT

                                                                                                                                                          const IS_OBJECT: string;

                                                                                                                                                            variable IS_OCTAL

                                                                                                                                                            const IS_OCTAL: string;

                                                                                                                                                              variable IS_PASSPORT_NUMBER

                                                                                                                                                              const IS_PASSPORT_NUMBER: string;

                                                                                                                                                                variable IS_PHONE_NUMBER

                                                                                                                                                                const IS_PHONE_NUMBER: string;

                                                                                                                                                                  variable IS_PORT

                                                                                                                                                                  const IS_PORT: string;

                                                                                                                                                                    variable IS_POSITIVE

                                                                                                                                                                    const IS_POSITIVE: string;

                                                                                                                                                                      variable IS_POSTAL_CODE

                                                                                                                                                                      const IS_POSTAL_CODE: string;

                                                                                                                                                                        variable IS_RFC_3339

                                                                                                                                                                        const IS_RFC_3339: string;

                                                                                                                                                                          variable IS_RGB_COLOR

                                                                                                                                                                          const IS_RGB_COLOR: string;

                                                                                                                                                                            variable IS_SEM_VER

                                                                                                                                                                            const IS_SEM_VER: string;

                                                                                                                                                                              variable IS_STRING

                                                                                                                                                                              const IS_STRING: string;

                                                                                                                                                                                variable IS_STRONG_PASSWORD

                                                                                                                                                                                const IS_STRONG_PASSWORD: string;

                                                                                                                                                                                  variable IS_SURROGATE_PAIR

                                                                                                                                                                                  const IS_SURROGATE_PAIR: string;

                                                                                                                                                                                    variable IS_TAX_ID

                                                                                                                                                                                    const IS_TAX_ID: string;

                                                                                                                                                                                      variable IS_TIMEZONE

                                                                                                                                                                                      const IS_TIMEZONE: string;

                                                                                                                                                                                        variable IS_UPPERCASE

                                                                                                                                                                                        const IS_UPPERCASE: string;

                                                                                                                                                                                          variable IS_URL

                                                                                                                                                                                          const IS_URL: string;

                                                                                                                                                                                            variable IS_UUID

                                                                                                                                                                                            const IS_UUID: string;

                                                                                                                                                                                              variable IS_VARIABLE_WIDTH

                                                                                                                                                                                              const IS_VARIABLE_WIDTH: string;

                                                                                                                                                                                                variable MATCHES

                                                                                                                                                                                                const MATCHES: string;

                                                                                                                                                                                                  variable MAX

                                                                                                                                                                                                  const MAX: string;

                                                                                                                                                                                                    variable MAX_DATE

                                                                                                                                                                                                    const MAX_DATE: string;

                                                                                                                                                                                                      variable MAX_LENGTH

                                                                                                                                                                                                      const MAX_LENGTH: string;

                                                                                                                                                                                                        variable MIN

                                                                                                                                                                                                        const MIN: string;

                                                                                                                                                                                                          variable MIN_DATE

                                                                                                                                                                                                          const MIN_DATE: string;

                                                                                                                                                                                                            variable MIN_LENGTH

                                                                                                                                                                                                            const MIN_LENGTH: string;

                                                                                                                                                                                                              variable NOT_CONTAINS

                                                                                                                                                                                                              const NOT_CONTAINS: string;

                                                                                                                                                                                                                variable NOT_EQUALS

                                                                                                                                                                                                                const NOT_EQUALS: string;

                                                                                                                                                                                                                  Functions

                                                                                                                                                                                                                  function Allow

                                                                                                                                                                                                                  Allow: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                  • If object has both allowed and not allowed properties a validation error will be thrown.

                                                                                                                                                                                                                  function arrayContains

                                                                                                                                                                                                                  arrayContains: (array: unknown, values: any[]) => boolean;
                                                                                                                                                                                                                  • Checks if array contains all values from the given array of values. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function ArrayContains

                                                                                                                                                                                                                  ArrayContains: (
                                                                                                                                                                                                                  values: any[],
                                                                                                                                                                                                                  validationOptions?: ValidationOptions
                                                                                                                                                                                                                  ) => PropertyDecorator;
                                                                                                                                                                                                                  • Checks if array contains all values from the given array of values. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function arrayMaxSize

                                                                                                                                                                                                                  arrayMaxSize: (array: unknown, max: number) => boolean;
                                                                                                                                                                                                                  • Checks if the array's length is less or equal to the specified number. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function ArrayMaxSize

                                                                                                                                                                                                                  ArrayMaxSize: (
                                                                                                                                                                                                                  max: number,
                                                                                                                                                                                                                  validationOptions?: ValidationOptions
                                                                                                                                                                                                                  ) => PropertyDecorator;
                                                                                                                                                                                                                  • Checks if the array's length is less or equal to the specified number. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function arrayMinSize

                                                                                                                                                                                                                  arrayMinSize: (array: unknown, min: number) => boolean;
                                                                                                                                                                                                                  • Checks if the array's length is greater than or equal to the specified number. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function ArrayMinSize

                                                                                                                                                                                                                  ArrayMinSize: (
                                                                                                                                                                                                                  min: number,
                                                                                                                                                                                                                  validationOptions?: ValidationOptions
                                                                                                                                                                                                                  ) => PropertyDecorator;
                                                                                                                                                                                                                  • Checks if the array's length is greater than or equal to the specified number. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function arrayNotContains

                                                                                                                                                                                                                  arrayNotContains: (array: unknown, values: any[]) => boolean;
                                                                                                                                                                                                                  • Checks if array does not contain any of the given values. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function ArrayNotContains

                                                                                                                                                                                                                  ArrayNotContains: (
                                                                                                                                                                                                                  values: any[],
                                                                                                                                                                                                                  validationOptions?: ValidationOptions
                                                                                                                                                                                                                  ) => PropertyDecorator;
                                                                                                                                                                                                                  • Checks if array does not contain any of the given values. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function arrayNotEmpty

                                                                                                                                                                                                                  arrayNotEmpty: (array: unknown) => boolean;
                                                                                                                                                                                                                  • Checks if given array is not empty. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function ArrayNotEmpty

                                                                                                                                                                                                                  ArrayNotEmpty: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                  • Checks if given array is not empty. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function arrayUnique

                                                                                                                                                                                                                  arrayUnique: (array: unknown[], identifier?: ArrayUniqueIdentifier) => boolean;
                                                                                                                                                                                                                  • Checks if all array's values are unique. Comparison for objects is reference-based. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function ArrayUnique

                                                                                                                                                                                                                  ArrayUnique: <T = any>(
                                                                                                                                                                                                                  identifierOrOptions?: ArrayUniqueIdentifier<T> | ValidationOptions,
                                                                                                                                                                                                                  validationOptions?: ValidationOptions
                                                                                                                                                                                                                  ) => PropertyDecorator;
                                                                                                                                                                                                                  • Checks if all array's values are unique. Comparison for objects is reference-based. If null or undefined is given then this function returns false.

                                                                                                                                                                                                                  function buildMessage

                                                                                                                                                                                                                  buildMessage: (
                                                                                                                                                                                                                  impl: (eachPrefix: string, args?: ValidationArguments) => string,
                                                                                                                                                                                                                  validationOptions?: ValidationOptions
                                                                                                                                                                                                                  ) => (validationArguments?: ValidationArguments) => string;

                                                                                                                                                                                                                    function contains

                                                                                                                                                                                                                    contains: (value: unknown, seed: string) => boolean;
                                                                                                                                                                                                                    • Checks if the string contains the seed. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function Contains

                                                                                                                                                                                                                    Contains: (
                                                                                                                                                                                                                    seed: string,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string contains the seed. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function equals

                                                                                                                                                                                                                    equals: (value: unknown, comparison: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if value matches ("===") the comparison.

                                                                                                                                                                                                                    function Equals

                                                                                                                                                                                                                    Equals: (
                                                                                                                                                                                                                    comparison: any,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if value matches ("===") the comparison.

                                                                                                                                                                                                                    function getFromContainer

                                                                                                                                                                                                                    getFromContainer: <T>(someClass: Function | (new (...args: any[]) => T)) => T;
                                                                                                                                                                                                                    • Gets the IOC container used by this library.

                                                                                                                                                                                                                    function getMetadataStorage

                                                                                                                                                                                                                    getMetadataStorage: () => MetadataStorage;
                                                                                                                                                                                                                    • Gets metadata storage. Metadata storage follows the best practices and stores metadata in a global variable.

                                                                                                                                                                                                                    function isAlpha

                                                                                                                                                                                                                    isAlpha: (value: unknown, locale?: ValidatorJS.AlphaLocale) => boolean;
                                                                                                                                                                                                                    • Checks if the string contains only letters (a-zA-Z). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsAlpha

                                                                                                                                                                                                                    IsAlpha: (
                                                                                                                                                                                                                    locale?: ValidatorJS.AlphaLocale,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string contains only letters (a-zA-Z). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isAlphanumeric

                                                                                                                                                                                                                    isAlphanumeric: (
                                                                                                                                                                                                                    value: unknown,
                                                                                                                                                                                                                    locale?: ValidatorJS.AlphanumericLocale
                                                                                                                                                                                                                    ) => boolean;
                                                                                                                                                                                                                    • Checks if the string contains only letters and numbers. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsAlphanumeric

                                                                                                                                                                                                                    IsAlphanumeric: (
                                                                                                                                                                                                                    locale?: ValidatorJS.AlphanumericLocale,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string contains only letters and numbers. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isArray

                                                                                                                                                                                                                    isArray: <T = any>(value: unknown) => value is T[];
                                                                                                                                                                                                                    • Checks if a given value is an array

                                                                                                                                                                                                                    function IsArray

                                                                                                                                                                                                                    IsArray: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a given value is an array

                                                                                                                                                                                                                    function isAscii

                                                                                                                                                                                                                    isAscii: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string contains ASCII chars only. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsAscii

                                                                                                                                                                                                                    IsAscii: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string contains ASCII chars only. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isBase32

                                                                                                                                                                                                                    isBase32: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if a string is base32 encoded. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsBase32

                                                                                                                                                                                                                    IsBase32: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if a string is base32 encoded. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isBase58

                                                                                                                                                                                                                    isBase58: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if a string is base58 encoded. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsBase58

                                                                                                                                                                                                                    IsBase58: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a string is base58 encoded. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isBase64

                                                                                                                                                                                                                    isBase64: (value: unknown, options?: ValidatorJS.IsBase64Options) => boolean;
                                                                                                                                                                                                                    • Checks if a string is base64 encoded. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsBase64

                                                                                                                                                                                                                    IsBase64: (
                                                                                                                                                                                                                    options?: ValidatorJS.IsBase64Options,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a string is base64 encoded. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isBIC

                                                                                                                                                                                                                    isBIC: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if a string is a BIC (Bank Identification Code) or SWIFT code. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsBIC

                                                                                                                                                                                                                    IsBIC: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if a string is a BIC (Bank Identification Code) or SWIFT code. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isBoolean

                                                                                                                                                                                                                    isBoolean: (value: unknown) => value is boolean;
                                                                                                                                                                                                                    • Checks if a given value is a boolean.

                                                                                                                                                                                                                    function IsBoolean

                                                                                                                                                                                                                    IsBoolean: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a value is a boolean.

                                                                                                                                                                                                                    function isBooleanString

                                                                                                                                                                                                                    isBooleanString: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if a string is a boolean. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsBooleanString

                                                                                                                                                                                                                    IsBooleanString: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a string is a boolean. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isBtcAddress

                                                                                                                                                                                                                    isBtcAddress: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a valid BTC address. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsBtcAddress

                                                                                                                                                                                                                    IsBtcAddress: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a valid BTC address. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isByteLength

                                                                                                                                                                                                                    isByteLength: (value: unknown, min: number, max?: number) => boolean;
                                                                                                                                                                                                                    • Checks if the string's length (in bytes) falls in a range. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsByteLength

                                                                                                                                                                                                                    IsByteLength: (
                                                                                                                                                                                                                    min: number,
                                                                                                                                                                                                                    max?: number,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string's length (in bytes) falls in a range. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isCreditCard

                                                                                                                                                                                                                    isCreditCard: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a credit card. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsCreditCard

                                                                                                                                                                                                                    IsCreditCard: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a credit card. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isCurrency

                                                                                                                                                                                                                    isCurrency: (value: unknown, options?: ValidatorJS.IsCurrencyOptions) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a valid currency amount. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsCurrency

                                                                                                                                                                                                                    IsCurrency: (
                                                                                                                                                                                                                    options?: ValidatorJS.IsCurrencyOptions,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a valid currency amount. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isDataURI

                                                                                                                                                                                                                    isDataURI: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a data uri format. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsDataURI

                                                                                                                                                                                                                    IsDataURI: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a data uri format. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isDate

                                                                                                                                                                                                                    isDate: (value: unknown) => value is Date;
                                                                                                                                                                                                                    • Checks if a given value is a date.

                                                                                                                                                                                                                    function IsDate

                                                                                                                                                                                                                    IsDate: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a value is a date.

                                                                                                                                                                                                                    function isDateString

                                                                                                                                                                                                                    isDateString: (
                                                                                                                                                                                                                    value: unknown,
                                                                                                                                                                                                                    options?: ValidatorJS.IsISO8601Options
                                                                                                                                                                                                                    ) => boolean;
                                                                                                                                                                                                                    • Alias for IsISO8601 validator

                                                                                                                                                                                                                    function IsDateString

                                                                                                                                                                                                                    IsDateString: (
                                                                                                                                                                                                                    options?: ValidatorJS.IsISO8601Options,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Alias for IsISO8601 validator

                                                                                                                                                                                                                    function isDecimal

                                                                                                                                                                                                                    isDecimal: (value: unknown, options?: ValidatorJS.IsDecimalOptions) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a valid decimal. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsDecimal

                                                                                                                                                                                                                    IsDecimal: (
                                                                                                                                                                                                                    options?: ValidatorJS.IsDecimalOptions,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a valid decimal. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isDefined

                                                                                                                                                                                                                    isDefined: <T>(value: T | undefined | null) => value is T;
                                                                                                                                                                                                                    • Checks if value is defined (!== undefined, !== null).

                                                                                                                                                                                                                    function IsDefined

                                                                                                                                                                                                                    IsDefined: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if value is defined (!== undefined, !== null).

                                                                                                                                                                                                                    function isDivisibleBy

                                                                                                                                                                                                                    isDivisibleBy: (value: unknown, num: number) => boolean;
                                                                                                                                                                                                                    • Checks if value is a number that's divisible by another.

                                                                                                                                                                                                                    function IsDivisibleBy

                                                                                                                                                                                                                    IsDivisibleBy: (
                                                                                                                                                                                                                    num: number,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if value is a number that's divisible by another.

                                                                                                                                                                                                                    function isEAN

                                                                                                                                                                                                                    isEAN: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is an EAN (European Article Number). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsEAN

                                                                                                                                                                                                                    IsEAN: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is an EAN (European Article Number). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isEmail

                                                                                                                                                                                                                    isEmail: (value: unknown, options?: ValidatorJS.IsEmailOptions) => boolean;
                                                                                                                                                                                                                    • Checks if the string is an email. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsEmail

                                                                                                                                                                                                                    IsEmail: (
                                                                                                                                                                                                                    options?: ValidatorJS.IsEmailOptions,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is an email. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isEmpty

                                                                                                                                                                                                                    isEmpty: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if given value is empty (=== '', === null, === undefined).

                                                                                                                                                                                                                    function IsEmpty

                                                                                                                                                                                                                    IsEmpty: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if given value is empty (=== '', === null, === undefined).

                                                                                                                                                                                                                    function isEnum

                                                                                                                                                                                                                    isEnum: (value: unknown, entity: any) => boolean;
                                                                                                                                                                                                                    • Checks if a given value is the member of the provided enum.

                                                                                                                                                                                                                    function IsEnum

                                                                                                                                                                                                                    IsEnum: (
                                                                                                                                                                                                                    entity: object,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a given value is the member of the provided enum.

                                                                                                                                                                                                                    function isEthereumAddress

                                                                                                                                                                                                                    isEthereumAddress: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is an Ethereum address using basic regex. Does not validate address checksums. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsEthereumAddress

                                                                                                                                                                                                                    IsEthereumAddress: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is an Ethereum address using basic regex. Does not validate address checksums. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isFirebasePushId

                                                                                                                                                                                                                    isFirebasePushId: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a Firebase Push Id If given value is not a Firebase Push Id, it returns false

                                                                                                                                                                                                                    function IsFirebasePushId

                                                                                                                                                                                                                    IsFirebasePushId: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a Firebase Push Id If given value is not a Firebase Push Id, it returns false

                                                                                                                                                                                                                    function isFQDN

                                                                                                                                                                                                                    isFQDN: (value: unknown, options?: ValidatorJS.IsFQDNOptions) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a fully qualified domain name (e.g. domain.com). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsFQDN

                                                                                                                                                                                                                    IsFQDN: (
                                                                                                                                                                                                                    options?: ValidatorJS.IsFQDNOptions,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a fully qualified domain name (e.g. domain.com). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isFullWidth

                                                                                                                                                                                                                    isFullWidth: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string contains any full-width chars. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsFullWidth

                                                                                                                                                                                                                    IsFullWidth: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string contains any full-width chars. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isHalfWidth

                                                                                                                                                                                                                    isHalfWidth: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string contains any half-width chars. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsHalfWidth

                                                                                                                                                                                                                    IsHalfWidth: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string contains any half-width chars. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isHash

                                                                                                                                                                                                                    isHash: (value: unknown, algorithm: ValidatorJS.HashAlgorithm) => boolean;
                                                                                                                                                                                                                    • Check if the string is a hash of type algorithm. Algorithm is one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', 'tiger160', 'tiger192', 'crc32', 'crc32b']

                                                                                                                                                                                                                    function IsHash

                                                                                                                                                                                                                    IsHash: (
                                                                                                                                                                                                                    algorithm: string,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a hash of type algorithm. Algorithm is one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', 'tiger160', 'tiger192', 'crc32', 'crc32b']

                                                                                                                                                                                                                    function isHexadecimal

                                                                                                                                                                                                                    isHexadecimal: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a hexadecimal number. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsHexadecimal

                                                                                                                                                                                                                    IsHexadecimal: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a hexadecimal number. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isHexColor

                                                                                                                                                                                                                    isHexColor: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a hexadecimal color. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsHexColor

                                                                                                                                                                                                                    IsHexColor: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a hexadecimal color. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isHSL

                                                                                                                                                                                                                    isHSL: (value: unknown) => 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)). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsHSL

                                                                                                                                                                                                                    IsHSL: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • 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)). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isIBAN

                                                                                                                                                                                                                    isIBAN: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if a string is a IBAN (International Bank Account Number). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsIBAN

                                                                                                                                                                                                                    IsIBAN: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if a string is a IBAN (International Bank Account Number). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isIdentityCard

                                                                                                                                                                                                                    isIdentityCard: (
                                                                                                                                                                                                                    value: unknown,
                                                                                                                                                                                                                    locale: ValidatorJS.IdentityCardLocale
                                                                                                                                                                                                                    ) => boolean;
                                                                                                                                                                                                                    • Check if the string is a valid identity card code. locale is one of ['ES', 'zh-TW', 'he-IL', 'ar-TN'] OR 'any'. If 'any' is used, function will check if any of the locals match. Defaults to 'any'. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsIdentityCard

                                                                                                                                                                                                                    IsIdentityCard: (
                                                                                                                                                                                                                    locale?: ValidatorJS.IdentityCardLocale,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a valid identity card code. locale is one of ['ES', 'zh-TW', 'he-IL', 'ar-TN'] OR 'any'. If 'any' is used, function will check if any of the locals match. Defaults to 'any'. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isIn

                                                                                                                                                                                                                    isIn: (value: unknown, possibleValues: readonly unknown[]) => boolean;
                                                                                                                                                                                                                    • Checks if given value is in a array of allowed values.

                                                                                                                                                                                                                    function IsIn

                                                                                                                                                                                                                    IsIn: (
                                                                                                                                                                                                                    values: readonly any[],
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if given value is in a array of allowed values.

                                                                                                                                                                                                                    function isInstance

                                                                                                                                                                                                                    isInstance: (
                                                                                                                                                                                                                    object: unknown,
                                                                                                                                                                                                                    targetTypeConstructor: new (...args: any[]) => any
                                                                                                                                                                                                                    ) => boolean;
                                                                                                                                                                                                                    • Checks if the value is an instance of the specified object.

                                                                                                                                                                                                                    function IsInstance

                                                                                                                                                                                                                    IsInstance: (
                                                                                                                                                                                                                    targetType: new (...args: any[]) => any,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the value is an instance of the specified object.

                                                                                                                                                                                                                    function isInt

                                                                                                                                                                                                                    isInt: (val: unknown) => val is Number;
                                                                                                                                                                                                                    • Checks if value is an integer.

                                                                                                                                                                                                                    function IsInt

                                                                                                                                                                                                                    IsInt: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if value is an integer.

                                                                                                                                                                                                                    function isIP

                                                                                                                                                                                                                    isIP: (value: unknown, version?: IsIpVersion) => boolean;
                                                                                                                                                                                                                    • Checks if the string is an IP (version 4 or 6). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsIP

                                                                                                                                                                                                                    IsIP: (
                                                                                                                                                                                                                    version?: IsIpVersion,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is an IP (version 4 or 6). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isISBN

                                                                                                                                                                                                                    isISBN: (value: unknown, version?: IsISBNVersion) => boolean;
                                                                                                                                                                                                                    • Checks if the string is an ISBN (version 10 or 13). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsISBN

                                                                                                                                                                                                                    IsISBN: (
                                                                                                                                                                                                                    version?: IsISBNVersion,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is an ISBN (version 10 or 13). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isISIN

                                                                                                                                                                                                                    isISIN: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string is an ISIN (stock/security identifier). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsISIN

                                                                                                                                                                                                                    IsISIN: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is an ISIN (stock/security identifier). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isISO31661Alpha2

                                                                                                                                                                                                                    isISO31661Alpha2: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a valid [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) officially assigned country code.

                                                                                                                                                                                                                    function IsISO31661Alpha2

                                                                                                                                                                                                                    IsISO31661Alpha2: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a valid [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) officially assigned country code.

                                                                                                                                                                                                                    function isISO31661Alpha3

                                                                                                                                                                                                                    isISO31661Alpha3: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a valid [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) officially assigned country code.

                                                                                                                                                                                                                    function IsISO31661Alpha3

                                                                                                                                                                                                                    IsISO31661Alpha3: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a valid [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) officially assigned country code.

                                                                                                                                                                                                                    function isISO4217CurrencyCode

                                                                                                                                                                                                                    isISO4217CurrencyCode: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a valid [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) officially assigned currency code.

                                                                                                                                                                                                                    function IsISO4217CurrencyCode

                                                                                                                                                                                                                    IsISO4217CurrencyCode: (
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a valid [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) officially assigned currency code.

                                                                                                                                                                                                                    function isISO8601

                                                                                                                                                                                                                    isISO8601: (value: unknown, options?: ValidatorJS.IsISO8601Options) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a valid ISO 8601 date. If given value is not a string, then it returns false. Use the option strict = true for additional checks for a valid date, e.g. invalidates dates like 2019-02-29.

                                                                                                                                                                                                                    function IsISO8601

                                                                                                                                                                                                                    IsISO8601: (
                                                                                                                                                                                                                    options?: ValidatorJS.IsISO8601Options,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a valid ISO 8601 date. If given value is not a string, then it returns false. Use the option strict = true for additional checks for a valid date, e.g. invalidates dates like 2019-02-29.

                                                                                                                                                                                                                    function isISRC

                                                                                                                                                                                                                    isISRC: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a ISRC. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsISRC

                                                                                                                                                                                                                    IsISRC: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a ISRC. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isISSN

                                                                                                                                                                                                                    isISSN: (value: unknown, options?: ValidatorJS.IsISSNOptions) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a ISSN. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsISSN

                                                                                                                                                                                                                    IsISSN: (
                                                                                                                                                                                                                    options?: ValidatorJS.IsISSNOptions,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a ISSN. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isJSON

                                                                                                                                                                                                                    isJSON: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string is valid JSON (note: uses JSON.parse). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsJSON

                                                                                                                                                                                                                    IsJSON: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is valid JSON (note: uses JSON.parse). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isJWT

                                                                                                                                                                                                                    isJWT: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string is valid JWT token. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsJWT

                                                                                                                                                                                                                    IsJWT: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is valid JWT token. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isLatitude

                                                                                                                                                                                                                    isLatitude: (value: string) => boolean;
                                                                                                                                                                                                                    • Checks if a given value is a latitude.

                                                                                                                                                                                                                    function IsLatitude

                                                                                                                                                                                                                    IsLatitude: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a given value is a latitude.

                                                                                                                                                                                                                    function isLatLong

                                                                                                                                                                                                                    isLatLong: (value: string) => boolean;
                                                                                                                                                                                                                    • Checks if a value is string in format a "latitude,longitude".

                                                                                                                                                                                                                    function IsLatLong

                                                                                                                                                                                                                    IsLatLong: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a value is string in format a "latitude,longitude".

                                                                                                                                                                                                                    function isLocale

                                                                                                                                                                                                                    isLocale: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a locale. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsLocale

                                                                                                                                                                                                                    IsLocale: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a locale. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isLongitude

                                                                                                                                                                                                                    isLongitude: (value: string) => boolean;
                                                                                                                                                                                                                    • Checks if a given value is a longitude.

                                                                                                                                                                                                                    function IsLongitude

                                                                                                                                                                                                                    IsLongitude: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a given value is a longitude.

                                                                                                                                                                                                                    function isLowercase

                                                                                                                                                                                                                    isLowercase: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string is lowercase. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsLowercase

                                                                                                                                                                                                                    IsLowercase: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is lowercase. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isMACAddress

                                                                                                                                                                                                                    isMACAddress: (
                                                                                                                                                                                                                    value: unknown,
                                                                                                                                                                                                                    options?: ValidatorJS.IsMACAddressOptions
                                                                                                                                                                                                                    ) => boolean;
                                                                                                                                                                                                                    • Check if the string is a MAC address. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsMACAddress

                                                                                                                                                                                                                    IsMACAddress: {
                                                                                                                                                                                                                    (
                                                                                                                                                                                                                    optionsArg?: ValidatorJS.IsMACAddressOptions,
                                                                                                                                                                                                                    validationOptionsArg?: ValidationOptions
                                                                                                                                                                                                                    ): PropertyDecorator;
                                                                                                                                                                                                                    (validationOptionsArg?: ValidationOptions): PropertyDecorator;
                                                                                                                                                                                                                    };
                                                                                                                                                                                                                    • Check if the string is a MAC address. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isMagnetURI

                                                                                                                                                                                                                    isMagnetURI: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a magnet uri format. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsMagnetURI

                                                                                                                                                                                                                    IsMagnetURI: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a magnet uri format. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isMilitaryTime

                                                                                                                                                                                                                    isMilitaryTime: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string represents a time without a given timezone in the format HH:MM (military) If the given value does not match the pattern HH:MM, then it returns false.

                                                                                                                                                                                                                    function IsMilitaryTime

                                                                                                                                                                                                                    IsMilitaryTime: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string represents a time without a given timezone in the format HH:MM (military) If the given value does not match the pattern HH:MM, then it returns false.

                                                                                                                                                                                                                    function isMimeType

                                                                                                                                                                                                                    isMimeType: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string matches to a valid MIME type format If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsMimeType

                                                                                                                                                                                                                    IsMimeType: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string matches to a valid MIME type format If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isMobilePhone

                                                                                                                                                                                                                    isMobilePhone: (
                                                                                                                                                                                                                    value: unknown,
                                                                                                                                                                                                                    locale?: ValidatorJS.MobilePhoneLocale,
                                                                                                                                                                                                                    options?: ValidatorJS.IsMobilePhoneOptions
                                                                                                                                                                                                                    ) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a mobile phone number (locale is either an array of locales (e.g ['sk-SK', 'sr-RS']) OR one of ['am-Am', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', ar-JO', 'ar-KW', 'ar-SA', 'ar-SY', 'ar-TN', 'be-BY', 'bg-BG', 'bn-BD', 'cs-CZ', 'da-DK', 'de-DE', 'de-AT', 'el-GR', 'en-AU', 'en-CA', 'en-GB', 'en-GG', 'en-GH', 'en-HK', 'en-MO', 'en-IE', 'en-IN', 'en-KE', 'en-MT', 'en-MU', 'en-NG', 'en-NZ', 'en-PK', 'en-RW', 'en-SG', 'en-SL', 'en-UG', 'en-US', 'en-TZ', 'en-ZA', 'en-ZM', 'es-CL', 'es-CR', 'es-EC', 'es-ES', 'es-MX', 'es-PA', 'es-PY', 'es-UY', 'et-EE', 'fa-IR', 'fi-FI', 'fj-FJ', 'fo-FO', 'fr-BE', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-RE', 'he-IL', 'hu-HU', 'id-ID', 'it-IT', 'ja-JP', 'kk-KZ', 'kl-GL', 'ko-KR', 'lt-LT', 'ms-MY', 'nb-NO', 'ne-NP', 'nl-BE', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ro-RO', 'ru-RU', 'sl-SI', 'sk-SK', 'sr-RS', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-MO', 'zh-TW'] If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsMobilePhone

                                                                                                                                                                                                                    IsMobilePhone: (
                                                                                                                                                                                                                    locale?: ValidatorJS.MobilePhoneLocale,
                                                                                                                                                                                                                    options?: ValidatorJS.IsMobilePhoneOptions,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a mobile phone number (locale is either an array of locales (e.g ['sk-SK', 'sr-RS']) OR one of ['am-Am', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', ar-JO', 'ar-KW', 'ar-SA', 'ar-SY', 'ar-TN', 'be-BY', 'bg-BG', 'bn-BD', 'cs-CZ', 'da-DK', 'de-DE', 'de-AT', 'el-GR', 'en-AU', 'en-CA', 'en-GB', 'en-GG', 'en-GH', 'en-HK', 'en-MO', 'en-IE', 'en-IN', 'en-KE', 'en-MT', 'en-MU', 'en-NG', 'en-NZ', 'en-PK', 'en-RW', 'en-SG', 'en-SL', 'en-UG', 'en-US', 'en-TZ', 'en-ZA', 'en-ZM', 'es-CL', 'es-CR', 'es-EC', 'es-ES', 'es-MX', 'es-PA', 'es-PY', 'es-UY', 'et-EE', 'fa-IR', 'fi-FI', 'fj-FJ', 'fo-FO', 'fr-BE', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-RE', 'he-IL', 'hu-HU', 'id-ID', 'it-IT', 'ja-JP', 'kk-KZ', 'kl-GL', 'ko-KR', 'lt-LT', 'ms-MY', 'nb-NO', 'ne-NP', 'nl-BE', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ro-RO', 'ru-RU', 'sl-SI', 'sk-SK', 'sr-RS', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-MO', 'zh-TW'] If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isMongoId

                                                                                                                                                                                                                    isMongoId: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a valid hex-encoded representation of a MongoDB ObjectId. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsMongoId

                                                                                                                                                                                                                    IsMongoId: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a valid hex-encoded representation of a MongoDB ObjectId. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isMultibyte

                                                                                                                                                                                                                    isMultibyte: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string contains one or more multibyte chars. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsMultibyte

                                                                                                                                                                                                                    IsMultibyte: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string contains one or more multibyte chars. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isNegative

                                                                                                                                                                                                                    isNegative: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the value is a negative number smaller than zero.

                                                                                                                                                                                                                    function IsNegative

                                                                                                                                                                                                                    IsNegative: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the value is a negative number smaller than zero.

                                                                                                                                                                                                                    function isNotEmpty

                                                                                                                                                                                                                    isNotEmpty: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if given value is not empty (!== '', !== null, !== undefined).

                                                                                                                                                                                                                    function IsNotEmpty

                                                                                                                                                                                                                    IsNotEmpty: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if given value is not empty (!== '', !== null, !== undefined).

                                                                                                                                                                                                                    function isNotEmptyObject

                                                                                                                                                                                                                    isNotEmptyObject: (value: unknown, options?: { nullable?: boolean }) => boolean;
                                                                                                                                                                                                                    • Checks if the value is valid Object & not empty. Returns false if the value is not an object or an empty valid object.

                                                                                                                                                                                                                    function IsNotEmptyObject

                                                                                                                                                                                                                    IsNotEmptyObject: (
                                                                                                                                                                                                                    options?: { nullable?: boolean },
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the value is valid Object & not empty. Returns false if the value is not an object or an empty valid object.

                                                                                                                                                                                                                    function isNotIn

                                                                                                                                                                                                                    isNotIn: (value: unknown, possibleValues: readonly unknown[]) => boolean;
                                                                                                                                                                                                                    • Checks if given value not in a array of allowed values.

                                                                                                                                                                                                                    function IsNotIn

                                                                                                                                                                                                                    IsNotIn: (
                                                                                                                                                                                                                    values: readonly any[],
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if given value not in a array of allowed values.

                                                                                                                                                                                                                    function isNumber

                                                                                                                                                                                                                    isNumber: (value: unknown, options?: IsNumberOptions) => value is number;
                                                                                                                                                                                                                    • Checks if a given value is a number.

                                                                                                                                                                                                                    function IsNumber

                                                                                                                                                                                                                    IsNumber: (
                                                                                                                                                                                                                    options?: IsNumberOptions,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a value is a number.

                                                                                                                                                                                                                    function isNumberString

                                                                                                                                                                                                                    isNumberString: (
                                                                                                                                                                                                                    value: unknown,
                                                                                                                                                                                                                    options?: ValidatorJS.IsNumericOptions
                                                                                                                                                                                                                    ) => boolean;
                                                                                                                                                                                                                    • Checks if the string is numeric. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsNumberString

                                                                                                                                                                                                                    IsNumberString: (
                                                                                                                                                                                                                    options?: ValidatorJS.IsNumericOptions,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is numeric. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isObject

                                                                                                                                                                                                                    isObject: <T = object>(value: unknown) => value is T;
                                                                                                                                                                                                                    • Checks if the value is valid Object. Returns false if the value is not an object.

                                                                                                                                                                                                                    function IsObject

                                                                                                                                                                                                                    IsObject: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the value is valid Object. Returns false if the value is not an object.

                                                                                                                                                                                                                    function isOctal

                                                                                                                                                                                                                    isOctal: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a valid octal number. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsOctal

                                                                                                                                                                                                                    IsOctal: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a valid octal number. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsOptional

                                                                                                                                                                                                                    IsOptional: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if value is missing and if so, ignores all validators.

                                                                                                                                                                                                                    function isPassportNumber

                                                                                                                                                                                                                    isPassportNumber: (value: unknown, countryCode: string) => boolean;
                                                                                                                                                                                                                    • Check if the string is a valid passport number relative to a specific country code. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsPassportNumber

                                                                                                                                                                                                                    IsPassportNumber: (
                                                                                                                                                                                                                    countryCode: string,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a valid passport number relative to a specific country code. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isPhoneNumber

                                                                                                                                                                                                                    isPhoneNumber: (value: string, region?: CountryCode) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a valid phone number. To successfully validate any phone number the text must include the intl. calling code, if the calling code wont be provided then the region must be set.

                                                                                                                                                                                                                      Parameter value

                                                                                                                                                                                                                      the potential phone number string to test

                                                                                                                                                                                                                      Parameter region

                                                                                                                                                                                                                      2 characters uppercase country code (e.g. DE, US, CH) for country specific validation. If text doesn't start with the international calling code (e.g. +41), then you must set this parameter.

                                                                                                                                                                                                                    function IsPhoneNumber

                                                                                                                                                                                                                    IsPhoneNumber: (
                                                                                                                                                                                                                    region?: CountryCode,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a valid phone number. To successfully validate any phone number the text must include the intl. calling code, if the calling code wont be provided then the region must be set.

                                                                                                                                                                                                                      Parameter region

                                                                                                                                                                                                                      2 characters uppercase country code (e.g. DE, US, CH) for country specific validation. If text doesn't start with the international calling code (e.g. +41), then you must set this parameter.

                                                                                                                                                                                                                    function isPort

                                                                                                                                                                                                                    isPort: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a valid port number.

                                                                                                                                                                                                                    function IsPort

                                                                                                                                                                                                                    IsPort: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a valid port number.

                                                                                                                                                                                                                    function isPositive

                                                                                                                                                                                                                    isPositive: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the value is a positive number greater than zero.

                                                                                                                                                                                                                    function IsPositive

                                                                                                                                                                                                                    IsPositive: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the value is a positive number greater than zero.

                                                                                                                                                                                                                    function isPostalCode

                                                                                                                                                                                                                    isPostalCode: (
                                                                                                                                                                                                                    value: unknown,
                                                                                                                                                                                                                    locale: 'any' | ValidatorJS.PostalCodeLocale
                                                                                                                                                                                                                    ) => boolean;
                                                                                                                                                                                                                    • Check if the string is a postal code, in the specified locale. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsPostalCode

                                                                                                                                                                                                                    IsPostalCode: (
                                                                                                                                                                                                                    locale?: 'any' | ValidatorJS.PostalCodeLocale,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a postal code, in the specified locale. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isRFC3339

                                                                                                                                                                                                                    isRFC3339: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a valid RFC 3339 date. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsRFC3339

                                                                                                                                                                                                                    IsRFC3339: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a valid RFC 3339 date. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isRgbColor

                                                                                                                                                                                                                    isRgbColor: (value: unknown, includePercentValues?: boolean) => boolean;
                                                                                                                                                                                                                    • Check if the string is a rgb or rgba color. includePercentValues defaults to true. 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. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsRgbColor

                                                                                                                                                                                                                    IsRgbColor: (
                                                                                                                                                                                                                    includePercentValues?: boolean,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a rgb or rgba color. includePercentValues defaults to true. 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. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isSemVer

                                                                                                                                                                                                                    isSemVer: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Check if the string is a Semantic Versioning Specification (SemVer). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsSemVer

                                                                                                                                                                                                                    IsSemVer: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Check if the string is a Semantic Versioning Specification (SemVer). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isString

                                                                                                                                                                                                                    isString: (value: unknown) => value is string;
                                                                                                                                                                                                                    • Checks if a given value is a real string.

                                                                                                                                                                                                                    function IsString

                                                                                                                                                                                                                    IsString: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if a given value is a real string.

                                                                                                                                                                                                                    function isStrongPassword

                                                                                                                                                                                                                    isStrongPassword: (value: unknown, options?: IsStrongPasswordOptions) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a strong password. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsStrongPassword

                                                                                                                                                                                                                    IsStrongPassword: (
                                                                                                                                                                                                                    options?: IsStrongPasswordOptions,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a strong password. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isSurrogatePair

                                                                                                                                                                                                                    isSurrogatePair: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string contains any surrogate pairs chars. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsSurrogatePair

                                                                                                                                                                                                                    IsSurrogatePair: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string contains any surrogate pairs chars. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isTaxId

                                                                                                                                                                                                                    isTaxId: (value: unknown, locale?: string) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a valid tax ID. Default locale is en-US. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      Supported locales: bg-BG, cs-CZ, de-AT, de-DE, dk-DK, el-CY, el-GR, en-CA, en-IE, en-US, es-ES, et-EE, fi-FI, fr-BE, fr-FR, fr-LU, hr-HR, hu-HU, it-IT, lv-LV, mt-MT, nl-NL, pl-PL, pt-BR, pt-PT, ro-RO, sk-SK, sl-SI, sv-SE.

                                                                                                                                                                                                                    function IsTaxId

                                                                                                                                                                                                                    IsTaxId: (
                                                                                                                                                                                                                    locale?: string,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a valid tax ID. Default locale is en-US. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      Supported locales: bg-BG, cs-CZ, de-AT, de-DE, dk-DK, el-CY, el-GR, en-CA, en-IE, en-US, es-ES, et-EE, fi-FI, fr-BE, fr-FR, fr-LU, hr-HR, hu-HU, it-IT, lv-LV, mt-MT, nl-NL, pl-PL, pt-BR, pt-PT, ro-RO, sk-SK, sl-SI, sv-SE.

                                                                                                                                                                                                                    function isTimeZone

                                                                                                                                                                                                                    isTimeZone: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string represents a valid IANA timezone If the given value is not a valid IANA timezone, then it returns false.

                                                                                                                                                                                                                    function IsTimeZone

                                                                                                                                                                                                                    IsTimeZone: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string represents a valid IANA timezone If the given value is not a valid IANA timezone, then it returns false.

                                                                                                                                                                                                                    function isUppercase

                                                                                                                                                                                                                    isUppercase: (value: unknown) => boolean;
                                                                                                                                                                                                                    • Checks if the string is uppercase. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsUppercase

                                                                                                                                                                                                                    IsUppercase: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is uppercase. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isURL

                                                                                                                                                                                                                    isURL: (value: string, options?: ValidatorJS.IsURLOptions) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a url. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsUrl

                                                                                                                                                                                                                    IsUrl: (
                                                                                                                                                                                                                    options?: ValidatorJS.IsURLOptions,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a url. If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isUUID

                                                                                                                                                                                                                    isUUID: (value: unknown, version?: ValidatorJS.UUIDVersion) => boolean;
                                                                                                                                                                                                                    • Checks if the string is a UUID (version 3, 4 or 5). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function IsUUID

                                                                                                                                                                                                                    IsUUID: (
                                                                                                                                                                                                                    version?: ValidatorJS.UUIDVersion,
                                                                                                                                                                                                                    validationOptions?: ValidationOptions
                                                                                                                                                                                                                    ) => PropertyDecorator;
                                                                                                                                                                                                                    • Checks if the string is a UUID (version 3, 4 or 5). If given value is not a string, then it returns false.

                                                                                                                                                                                                                    function isValidationOptions

                                                                                                                                                                                                                    isValidationOptions: (val: any) => val is ValidationOptions;

                                                                                                                                                                                                                      function isVariableWidth

                                                                                                                                                                                                                      isVariableWidth: (value: unknown) => boolean;
                                                                                                                                                                                                                      • Checks if the string contains variable-width chars. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function IsVariableWidth

                                                                                                                                                                                                                      IsVariableWidth: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                      • Checks if the string contains variable-width chars. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function length

                                                                                                                                                                                                                      length: (value: unknown, min: number, max?: number) => boolean;
                                                                                                                                                                                                                      • Checks if the string's length falls in a range. Note: this function takes into account surrogate pairs. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function Length

                                                                                                                                                                                                                      Length: (
                                                                                                                                                                                                                      min: number,
                                                                                                                                                                                                                      max?: number,
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ) => PropertyDecorator;
                                                                                                                                                                                                                      • Checks if the string's length falls in a range. Note: this function takes into account surrogate pairs. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function matches

                                                                                                                                                                                                                      matches: {
                                                                                                                                                                                                                      (value: string, pattern: RegExp): boolean;
                                                                                                                                                                                                                      (value: string, pattern: string, modifiers: string): boolean;
                                                                                                                                                                                                                      };
                                                                                                                                                                                                                      • Checks if string matches the pattern. Either matches('foo', /foo/i). If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function Matches

                                                                                                                                                                                                                      Matches: {
                                                                                                                                                                                                                      (pattern: RegExp, validationOptions?: ValidationOptions): PropertyDecorator;
                                                                                                                                                                                                                      (
                                                                                                                                                                                                                      pattern: string,
                                                                                                                                                                                                                      modifiers?: string,
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ): PropertyDecorator;
                                                                                                                                                                                                                      };
                                                                                                                                                                                                                      • Checks if string matches the pattern. Either matches('foo', /foo/i) If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function max

                                                                                                                                                                                                                      max: (num: unknown, max: number) => boolean;
                                                                                                                                                                                                                      • Checks if the first number is less than or equal to the second.

                                                                                                                                                                                                                      function Max

                                                                                                                                                                                                                      Max: (
                                                                                                                                                                                                                      maxValue: number,
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ) => PropertyDecorator;
                                                                                                                                                                                                                      • Checks if the value is less than or equal to the allowed maximum value.

                                                                                                                                                                                                                      function maxDate

                                                                                                                                                                                                                      maxDate: (date: unknown, maxDate: Date | (() => Date)) => boolean;
                                                                                                                                                                                                                      • Checks if the value is a date that's before the specified date.

                                                                                                                                                                                                                      function MaxDate

                                                                                                                                                                                                                      MaxDate: (
                                                                                                                                                                                                                      date: Date | (() => Date),
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ) => PropertyDecorator;
                                                                                                                                                                                                                      • Checks if the value is a date that's after the specified date.

                                                                                                                                                                                                                      function maxLength

                                                                                                                                                                                                                      maxLength: (value: unknown, max: number) => boolean;
                                                                                                                                                                                                                      • Checks if the string's length is not more than given number. Note: this function takes into account surrogate pairs. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function MaxLength

                                                                                                                                                                                                                      MaxLength: (
                                                                                                                                                                                                                      max: number,
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ) => PropertyDecorator;
                                                                                                                                                                                                                      • Checks if the string's length is not more than given number. Note: this function takes into account surrogate pairs. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function min

                                                                                                                                                                                                                      min: (num: unknown, min: number) => boolean;
                                                                                                                                                                                                                      • Checks if the first number is greater than or equal to the second.

                                                                                                                                                                                                                      function Min

                                                                                                                                                                                                                      Min: (
                                                                                                                                                                                                                      minValue: number,
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ) => PropertyDecorator;
                                                                                                                                                                                                                      • Checks if the value is greater than or equal to the allowed minimum value.

                                                                                                                                                                                                                      function minDate

                                                                                                                                                                                                                      minDate: (date: unknown, minDate: Date | (() => Date)) => boolean;
                                                                                                                                                                                                                      • Checks if the value is a date that's after the specified date.

                                                                                                                                                                                                                      function MinDate

                                                                                                                                                                                                                      MinDate: (
                                                                                                                                                                                                                      date: Date | (() => Date),
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ) => PropertyDecorator;
                                                                                                                                                                                                                      • Checks if the value is a date that's after the specified date.

                                                                                                                                                                                                                      function minLength

                                                                                                                                                                                                                      minLength: (value: unknown, min: number) => boolean;
                                                                                                                                                                                                                      • Checks if the string's length is not less than given number. Note: this function takes into account surrogate pairs. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function MinLength

                                                                                                                                                                                                                      MinLength: (
                                                                                                                                                                                                                      min: number,
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ) => PropertyDecorator;
                                                                                                                                                                                                                      • Checks if the string's length is not less than given number. Note: this function takes into account surrogate pairs. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function notContains

                                                                                                                                                                                                                      notContains: (value: unknown, seed: string) => boolean;
                                                                                                                                                                                                                      • Checks if the string does not contain the seed. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function NotContains

                                                                                                                                                                                                                      NotContains: (
                                                                                                                                                                                                                      seed: string,
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ) => PropertyDecorator;
                                                                                                                                                                                                                      • Checks if the string does not contain the seed. If given value is not a string, then it returns false.

                                                                                                                                                                                                                      function notEquals

                                                                                                                                                                                                                      notEquals: (value: unknown, comparison: unknown) => boolean;
                                                                                                                                                                                                                      • Checks if value does not match ("!==") the comparison.

                                                                                                                                                                                                                      function NotEquals

                                                                                                                                                                                                                      NotEquals: (
                                                                                                                                                                                                                      comparison: any,
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ) => PropertyDecorator;
                                                                                                                                                                                                                      • Checks if value does not match ("!==") the comparison.

                                                                                                                                                                                                                      function registerDecorator

                                                                                                                                                                                                                      registerDecorator: (options: ValidationDecoratorOptions) => void;
                                                                                                                                                                                                                      • Registers a custom validation decorator.

                                                                                                                                                                                                                      function registerSchema

                                                                                                                                                                                                                      registerSchema: (schema: ValidationSchema) => void;
                                                                                                                                                                                                                      • Registers a new validation schema.

                                                                                                                                                                                                                      function useContainer

                                                                                                                                                                                                                      useContainer: (
                                                                                                                                                                                                                      iocContainer: { get(someClass: any): any },
                                                                                                                                                                                                                      options?: UseContainerOptions
                                                                                                                                                                                                                      ) => void;
                                                                                                                                                                                                                      • Sets container to be used by this library.

                                                                                                                                                                                                                      function validate

                                                                                                                                                                                                                      validate: {
                                                                                                                                                                                                                      (object: object, validatorOptions?: ValidatorOptions): Promise<
                                                                                                                                                                                                                      ValidationError[]
                                                                                                                                                                                                                      >;
                                                                                                                                                                                                                      (
                                                                                                                                                                                                                      schemaName: string,
                                                                                                                                                                                                                      object: object,
                                                                                                                                                                                                                      validatorOptions?: ValidatorOptions
                                                                                                                                                                                                                      ): Promise<ValidationError[]>;
                                                                                                                                                                                                                      };
                                                                                                                                                                                                                      • Validates given object.

                                                                                                                                                                                                                      • Validates given object by a given validation schema.

                                                                                                                                                                                                                      function Validate

                                                                                                                                                                                                                      Validate: {
                                                                                                                                                                                                                      (
                                                                                                                                                                                                                      constraintClass: Function,
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ): PropertyDecorator;
                                                                                                                                                                                                                      (
                                                                                                                                                                                                                      constraintClass: Function,
                                                                                                                                                                                                                      constraints?: any[],
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ): PropertyDecorator;
                                                                                                                                                                                                                      };
                                                                                                                                                                                                                      • Performs validation based on the given custom validation class. Validation class must be decorated with ValidatorConstraint decorator.

                                                                                                                                                                                                                      function ValidateBy

                                                                                                                                                                                                                      ValidateBy: (
                                                                                                                                                                                                                      options: ValidateByOptions,
                                                                                                                                                                                                                      validationOptions?: ValidationOptions
                                                                                                                                                                                                                      ) => PropertyDecorator;

                                                                                                                                                                                                                        function ValidateIf

                                                                                                                                                                                                                        ValidateIf: (
                                                                                                                                                                                                                        condition: (object: any, value: any) => boolean,
                                                                                                                                                                                                                        validationOptions?: ValidationOptions
                                                                                                                                                                                                                        ) => PropertyDecorator;
                                                                                                                                                                                                                        • Ignores the other validators on a property when the provided condition function returns false.

                                                                                                                                                                                                                        function ValidateNested

                                                                                                                                                                                                                        ValidateNested: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                        • Objects / object arrays marked with this decorator will also be validated.

                                                                                                                                                                                                                        function validateOrReject

                                                                                                                                                                                                                        validateOrReject: {
                                                                                                                                                                                                                        (object: object, validatorOptions?: ValidatorOptions): Promise<void>;
                                                                                                                                                                                                                        (
                                                                                                                                                                                                                        schemaName: string,
                                                                                                                                                                                                                        object: object,
                                                                                                                                                                                                                        validatorOptions?: ValidatorOptions
                                                                                                                                                                                                                        ): Promise<void>;
                                                                                                                                                                                                                        };
                                                                                                                                                                                                                        • Validates given object and reject on error.

                                                                                                                                                                                                                        • Validates given object by a given validation schema and reject on error.

                                                                                                                                                                                                                        function ValidatePromise

                                                                                                                                                                                                                        ValidatePromise: (validationOptions?: ValidationOptions) => PropertyDecorator;
                                                                                                                                                                                                                        • Resolve promise before validation

                                                                                                                                                                                                                        function validateSync

                                                                                                                                                                                                                        validateSync: {
                                                                                                                                                                                                                        (object: object, validatorOptions?: ValidatorOptions): ValidationError[];
                                                                                                                                                                                                                        (
                                                                                                                                                                                                                        schemaName: string,
                                                                                                                                                                                                                        object: object,
                                                                                                                                                                                                                        validatorOptions?: ValidatorOptions
                                                                                                                                                                                                                        ): ValidationError[];
                                                                                                                                                                                                                        };
                                                                                                                                                                                                                        • Performs sync validation of the given object. Note that this method completely ignores async validations. If you want to properly perform validation you need to call validate method instead.

                                                                                                                                                                                                                        • Validates given object by a given validation schema. Note that this method completely ignores async validations. If you want to properly perform validation you need to call validate method instead.

                                                                                                                                                                                                                        function ValidatorConstraint

                                                                                                                                                                                                                        ValidatorConstraint: (options?: {
                                                                                                                                                                                                                        name?: string;
                                                                                                                                                                                                                        async?: boolean;
                                                                                                                                                                                                                        }) => (target: Function) => void;
                                                                                                                                                                                                                        • Registers custom validator class.

                                                                                                                                                                                                                        Classes

                                                                                                                                                                                                                        class MetadataStorage

                                                                                                                                                                                                                        class MetadataStorage {}
                                                                                                                                                                                                                        • Storage all metadatas.

                                                                                                                                                                                                                        property hasValidationMetaData

                                                                                                                                                                                                                        readonly hasValidationMetaData: boolean;

                                                                                                                                                                                                                          method addConstraintMetadata

                                                                                                                                                                                                                          addConstraintMetadata: (metadata: ConstraintMetadata) => void;
                                                                                                                                                                                                                          • Adds a new constraint metadata.

                                                                                                                                                                                                                          method addValidationMetadata

                                                                                                                                                                                                                          addValidationMetadata: (metadata: ValidationMetadata) => void;
                                                                                                                                                                                                                          • Adds a new validation metadata.

                                                                                                                                                                                                                          method addValidationSchema

                                                                                                                                                                                                                          addValidationSchema: (schema: ValidationSchema) => void;
                                                                                                                                                                                                                          • Adds a new validation metadata.

                                                                                                                                                                                                                          method getTargetValidationMetadatas

                                                                                                                                                                                                                          getTargetValidationMetadatas: (
                                                                                                                                                                                                                          targetConstructor: Function,
                                                                                                                                                                                                                          targetSchema: string,
                                                                                                                                                                                                                          always: boolean,
                                                                                                                                                                                                                          strictGroups: boolean,
                                                                                                                                                                                                                          groups?: string[]
                                                                                                                                                                                                                          ) => ValidationMetadata[];
                                                                                                                                                                                                                          • Gets all validation metadatas for the given object with the given groups.

                                                                                                                                                                                                                          method getTargetValidatorConstraints

                                                                                                                                                                                                                          getTargetValidatorConstraints: (target: Function) => ConstraintMetadata[];
                                                                                                                                                                                                                          • Gets all validator constraints for the given object.

                                                                                                                                                                                                                          method groupByPropertyName

                                                                                                                                                                                                                          groupByPropertyName: (metadata: ValidationMetadata[]) => {
                                                                                                                                                                                                                          [propertyName: string]: ValidationMetadata[];
                                                                                                                                                                                                                          };
                                                                                                                                                                                                                          • Groups metadata by their property names.

                                                                                                                                                                                                                          class ValidationError

                                                                                                                                                                                                                          class ValidationError {}
                                                                                                                                                                                                                          • Validation error description.

                                                                                                                                                                                                                          property children

                                                                                                                                                                                                                          children?: ValidationError[];
                                                                                                                                                                                                                          • Contains all nested validation errors of the property.

                                                                                                                                                                                                                          property constraints

                                                                                                                                                                                                                          constraints?: { [type: string]: string };
                                                                                                                                                                                                                          • Constraints that failed validation with error messages.

                                                                                                                                                                                                                          property contexts

                                                                                                                                                                                                                          contexts?: { [type: string]: any };

                                                                                                                                                                                                                            property property

                                                                                                                                                                                                                            property: string;
                                                                                                                                                                                                                            • Object's property that haven't pass validation.

                                                                                                                                                                                                                            property target

                                                                                                                                                                                                                            target?: {};
                                                                                                                                                                                                                            • Object that was validated.

                                                                                                                                                                                                                              OPTIONAL - configurable via the ValidatorOptions.validationError.target option

                                                                                                                                                                                                                            property value

                                                                                                                                                                                                                            value?: any;
                                                                                                                                                                                                                            • Value that haven't pass a validation.

                                                                                                                                                                                                                              OPTIONAL - configurable via the ValidatorOptions.validationError.value option

                                                                                                                                                                                                                            method toString

                                                                                                                                                                                                                            toString: (
                                                                                                                                                                                                                            shouldDecorate?: boolean,
                                                                                                                                                                                                                            hasParent?: boolean,
                                                                                                                                                                                                                            parentPath?: string,
                                                                                                                                                                                                                            showConstraintMessages?: boolean
                                                                                                                                                                                                                            ) => string;
                                                                                                                                                                                                                            • Parameter shouldDecorate

                                                                                                                                                                                                                              decorate the message with ANSI formatter escape codes for better readability

                                                                                                                                                                                                                              Parameter hasParent

                                                                                                                                                                                                                              true when the error is a child of an another one

                                                                                                                                                                                                                              Parameter parentPath

                                                                                                                                                                                                                              path as string to the parent of this property

                                                                                                                                                                                                                              Parameter showConstraintMessages

                                                                                                                                                                                                                              show constraint messages instead of constraint names

                                                                                                                                                                                                                            class ValidationTypes

                                                                                                                                                                                                                            class ValidationTypes {}
                                                                                                                                                                                                                            • Validation types.

                                                                                                                                                                                                                            property CONDITIONAL_VALIDATION

                                                                                                                                                                                                                            static CONDITIONAL_VALIDATION: string;

                                                                                                                                                                                                                              property CUSTOM_VALIDATION

                                                                                                                                                                                                                              static CUSTOM_VALIDATION: string;

                                                                                                                                                                                                                                property IS_DEFINED

                                                                                                                                                                                                                                static IS_DEFINED: string;

                                                                                                                                                                                                                                  property NESTED_VALIDATION

                                                                                                                                                                                                                                  static NESTED_VALIDATION: string;

                                                                                                                                                                                                                                    property PROMISE_VALIDATION

                                                                                                                                                                                                                                    static PROMISE_VALIDATION: string;

                                                                                                                                                                                                                                      property WHITELIST

                                                                                                                                                                                                                                      static WHITELIST: string;

                                                                                                                                                                                                                                        method isValid

                                                                                                                                                                                                                                        static isValid: (type: string) => boolean;
                                                                                                                                                                                                                                        • Checks if validation type is valid.

                                                                                                                                                                                                                                        class Validator

                                                                                                                                                                                                                                        class Validator {}
                                                                                                                                                                                                                                        • Validator performs validation of the given object based on its metadata.

                                                                                                                                                                                                                                        method validate

                                                                                                                                                                                                                                        validate: {
                                                                                                                                                                                                                                        (object: object, options?: ValidatorOptions): Promise<ValidationError[]>;
                                                                                                                                                                                                                                        (schemaName: string, object: object, options?: ValidatorOptions): Promise<
                                                                                                                                                                                                                                        ValidationError[]
                                                                                                                                                                                                                                        >;
                                                                                                                                                                                                                                        };
                                                                                                                                                                                                                                        • Performs validation of the given object based on decorators used in given object class.

                                                                                                                                                                                                                                        • Performs validation of the given object based on validation schema.

                                                                                                                                                                                                                                        method validateOrReject

                                                                                                                                                                                                                                        validateOrReject: {
                                                                                                                                                                                                                                        (object: object, options?: ValidatorOptions): Promise<void>;
                                                                                                                                                                                                                                        (
                                                                                                                                                                                                                                        schemaName: string,
                                                                                                                                                                                                                                        object: object,
                                                                                                                                                                                                                                        options?: ValidatorOptions
                                                                                                                                                                                                                                        ): Promise<void>;
                                                                                                                                                                                                                                        };
                                                                                                                                                                                                                                        • Performs validation of the given object based on decorators used in given object class and reject on error.

                                                                                                                                                                                                                                        • Performs validation of the given object based on validation schema and reject on error.

                                                                                                                                                                                                                                        method validateSync

                                                                                                                                                                                                                                        validateSync: {
                                                                                                                                                                                                                                        (object: object, options?: ValidatorOptions): ValidationError[];
                                                                                                                                                                                                                                        (
                                                                                                                                                                                                                                        schemaName: string,
                                                                                                                                                                                                                                        object: object,
                                                                                                                                                                                                                                        options?: ValidatorOptions
                                                                                                                                                                                                                                        ): ValidationError[];
                                                                                                                                                                                                                                        };
                                                                                                                                                                                                                                        • Performs validation of the given object based on decorators used in given object class. NOTE: This method completely ignores all async validations.

                                                                                                                                                                                                                                        • Performs validation of the given object based on validation schema.

                                                                                                                                                                                                                                        Interfaces

                                                                                                                                                                                                                                        interface IsNumberOptions

                                                                                                                                                                                                                                        interface IsNumberOptions {}
                                                                                                                                                                                                                                        • Options to be passed to IsNumber decorator.

                                                                                                                                                                                                                                        property allowInfinity

                                                                                                                                                                                                                                        allowInfinity?: boolean;

                                                                                                                                                                                                                                          property allowNaN

                                                                                                                                                                                                                                          allowNaN?: boolean;

                                                                                                                                                                                                                                            property maxDecimalPlaces

                                                                                                                                                                                                                                            maxDecimalPlaces?: number;

                                                                                                                                                                                                                                              interface UseContainerOptions

                                                                                                                                                                                                                                              interface UseContainerOptions {}
                                                                                                                                                                                                                                              • Container options.

                                                                                                                                                                                                                                              property fallback

                                                                                                                                                                                                                                              fallback?: boolean;
                                                                                                                                                                                                                                              • If set to true, then default container will be used in the case if given container haven't returned anything.

                                                                                                                                                                                                                                              property fallbackOnErrors

                                                                                                                                                                                                                                              fallbackOnErrors?: boolean;
                                                                                                                                                                                                                                              • If set to true, then default container will be used in the case if given container thrown an exception.

                                                                                                                                                                                                                                              interface ValidateByOptions

                                                                                                                                                                                                                                              interface ValidateByOptions {}

                                                                                                                                                                                                                                                property async

                                                                                                                                                                                                                                                async?: boolean;

                                                                                                                                                                                                                                                  property constraints

                                                                                                                                                                                                                                                  constraints?: any[];

                                                                                                                                                                                                                                                    property name

                                                                                                                                                                                                                                                    name: string;

                                                                                                                                                                                                                                                      property validator

                                                                                                                                                                                                                                                      validator: ValidatorConstraintInterface | Function;

                                                                                                                                                                                                                                                        interface ValidationArguments

                                                                                                                                                                                                                                                        interface ValidationArguments {}
                                                                                                                                                                                                                                                        • Arguments being sent to message builders - user can create message either by simply returning a string, either by returning a function that accepts MessageArguments and returns a message string built based on these arguments.

                                                                                                                                                                                                                                                        property constraints

                                                                                                                                                                                                                                                        constraints: any[];
                                                                                                                                                                                                                                                        • Constraints set by this validation type.

                                                                                                                                                                                                                                                        property object

                                                                                                                                                                                                                                                        object: object;
                                                                                                                                                                                                                                                        • Object that is being validated.

                                                                                                                                                                                                                                                        property property

                                                                                                                                                                                                                                                        property: string;
                                                                                                                                                                                                                                                        • Name of the object's property being validated.

                                                                                                                                                                                                                                                        property targetName

                                                                                                                                                                                                                                                        targetName: string;
                                                                                                                                                                                                                                                        • Name of the target that is being validated.

                                                                                                                                                                                                                                                        property value

                                                                                                                                                                                                                                                        value: any;
                                                                                                                                                                                                                                                        • Validating value.

                                                                                                                                                                                                                                                        interface ValidationDecoratorOptions

                                                                                                                                                                                                                                                        interface ValidationDecoratorOptions {}

                                                                                                                                                                                                                                                          property async

                                                                                                                                                                                                                                                          async?: boolean;
                                                                                                                                                                                                                                                          • Indicates if this decorator will perform async validation.

                                                                                                                                                                                                                                                          property constraints

                                                                                                                                                                                                                                                          constraints?: any[];
                                                                                                                                                                                                                                                          • Array of validation constraints.

                                                                                                                                                                                                                                                          property name

                                                                                                                                                                                                                                                          name?: string;
                                                                                                                                                                                                                                                          • Name of the validation that is being registered.

                                                                                                                                                                                                                                                          property options

                                                                                                                                                                                                                                                          options?: ValidationOptions;
                                                                                                                                                                                                                                                          • Validator options.

                                                                                                                                                                                                                                                          property propertyName

                                                                                                                                                                                                                                                          propertyName: string;
                                                                                                                                                                                                                                                          • Target object's property name to be validated.

                                                                                                                                                                                                                                                          property target

                                                                                                                                                                                                                                                          target: Function;
                                                                                                                                                                                                                                                          • Target object to be validated.

                                                                                                                                                                                                                                                          property validator

                                                                                                                                                                                                                                                          validator: ValidatorConstraintInterface | Function;
                                                                                                                                                                                                                                                          • Validator that performs validation.

                                                                                                                                                                                                                                                          interface ValidationOptions

                                                                                                                                                                                                                                                          interface ValidationOptions {}
                                                                                                                                                                                                                                                          • Options used to pass to validation decorators.

                                                                                                                                                                                                                                                          property always

                                                                                                                                                                                                                                                          always?: boolean;
                                                                                                                                                                                                                                                          • Indicates if validation must be performed always, no matter of validation groups used.

                                                                                                                                                                                                                                                          property context

                                                                                                                                                                                                                                                          context?: any;

                                                                                                                                                                                                                                                            property each

                                                                                                                                                                                                                                                            each?: boolean;
                                                                                                                                                                                                                                                            • Specifies if validated value is an array and each of its items must be validated.

                                                                                                                                                                                                                                                            property groups

                                                                                                                                                                                                                                                            groups?: string[];
                                                                                                                                                                                                                                                            • Validation groups used for this validation.

                                                                                                                                                                                                                                                            property message

                                                                                                                                                                                                                                                            message?: string | ((validationArguments: ValidationArguments) => string);
                                                                                                                                                                                                                                                            • Error message to be used on validation fail. Message can be either string or a function that returns a string.

                                                                                                                                                                                                                                                            interface ValidationSchema

                                                                                                                                                                                                                                                            interface ValidationSchema {}
                                                                                                                                                                                                                                                            • Validation schema is a decorator-free way of validation of your objects. Also using validation schemas makes this library to be easily used with es6/es5.

                                                                                                                                                                                                                                                            property name

                                                                                                                                                                                                                                                            name: string;
                                                                                                                                                                                                                                                            • Schema name. This is required, because we tell validator to validate by this schema using its name.

                                                                                                                                                                                                                                                            property properties

                                                                                                                                                                                                                                                            properties: {
                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                            * Name of the object's property to be validated which holds an array of validation constraints.
                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                            [propertyName: string]: {
                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                            * Validation type. Should be one of the ValidationTypes value.
                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                            type: string;
                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                            * Validator name.
                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                            name?: string;
                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                            * Constraints set by validation type.
                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                            constraints?: any[];
                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                            * Error message used to be used on validation fail.
                                                                                                                                                                                                                                                            * You can use "$value" to use value that was failed by validation.
                                                                                                                                                                                                                                                            * You can use "$constraint1" and "$constraint2" keys in the message string,
                                                                                                                                                                                                                                                            * and they will be replaced with constraint values if they exist.
                                                                                                                                                                                                                                                            * Message can be either string, either a function that returns a string.
                                                                                                                                                                                                                                                            * Second option allows to use values and custom messages depend of them.
                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                            message?:
                                                                                                                                                                                                                                                            | string
                                                                                                                                                                                                                                                            | ((value?: any, constraint1?: any, constraint2?: any) => string);
                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                            * Specifies if validated value is an array and each of its item must be validated.
                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                            each?: boolean;
                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                            * Indicates if validation must be performed always, no matter of validation groups used.
                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                            always?: boolean;
                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                            * Validation groups used for this validation.
                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                            groups?: string[];
                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                            * Specific validation type options.
                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                            options?: any;
                                                                                                                                                                                                                                                            }[];
                                                                                                                                                                                                                                                            };
                                                                                                                                                                                                                                                            • Validated properties.

                                                                                                                                                                                                                                                            interface ValidatorConstraintInterface

                                                                                                                                                                                                                                                            interface ValidatorConstraintInterface {}
                                                                                                                                                                                                                                                            • Custom validators must implement this interface to provide custom validation logic.

                                                                                                                                                                                                                                                            method defaultMessage

                                                                                                                                                                                                                                                            defaultMessage: (validationArguments?: ValidationArguments) => string;
                                                                                                                                                                                                                                                            • Gets default message when validation for this constraint fail.

                                                                                                                                                                                                                                                            method validate

                                                                                                                                                                                                                                                            validate: (
                                                                                                                                                                                                                                                            value: any,
                                                                                                                                                                                                                                                            validationArguments?: ValidationArguments
                                                                                                                                                                                                                                                            ) => Promise<boolean> | boolean;
                                                                                                                                                                                                                                                            • Method to be called to perform custom validation over given value.

                                                                                                                                                                                                                                                            interface ValidatorOptions

                                                                                                                                                                                                                                                            interface ValidatorOptions {}
                                                                                                                                                                                                                                                            • Options passed to validator during validation.

                                                                                                                                                                                                                                                            property always

                                                                                                                                                                                                                                                            always?: boolean;
                                                                                                                                                                                                                                                            • Set default for always option of decorators. Default can be overridden in decorator options.

                                                                                                                                                                                                                                                            property dismissDefaultMessages

                                                                                                                                                                                                                                                            dismissDefaultMessages?: boolean;
                                                                                                                                                                                                                                                            • If set to true, the validation will not use default messages. Error message always will be undefined if its not explicitly set.

                                                                                                                                                                                                                                                            property enableDebugMessages

                                                                                                                                                                                                                                                            enableDebugMessages?: boolean;
                                                                                                                                                                                                                                                            • If set to true then class-validator will print extra warning messages to the console when something is not right.

                                                                                                                                                                                                                                                            property forbidNonWhitelisted

                                                                                                                                                                                                                                                            forbidNonWhitelisted?: boolean;
                                                                                                                                                                                                                                                            • If set to true, instead of stripping non-whitelisted properties validator will throw an error

                                                                                                                                                                                                                                                            property forbidUnknownValues

                                                                                                                                                                                                                                                            forbidUnknownValues?: boolean;
                                                                                                                                                                                                                                                            • Fails validation for objects unknown to class-validator. Defaults to true.

                                                                                                                                                                                                                                                              For instance, since a plain empty object has no annotations used for validation: - validate({}) // passes - validate({}, { forbidUnknownValues: true }) // fails. - validate(new SomeAnnotatedEmptyClass(), { forbidUnknownValues: true }) // passes.

                                                                                                                                                                                                                                                            property groups

                                                                                                                                                                                                                                                            groups?: string[];
                                                                                                                                                                                                                                                            • Groups to be used during validation of the object.

                                                                                                                                                                                                                                                            property skipMissingProperties

                                                                                                                                                                                                                                                            skipMissingProperties?: boolean;
                                                                                                                                                                                                                                                            • If set to true then validator will skip validation of all properties that are null or undefined in the validating object.

                                                                                                                                                                                                                                                            property skipNullProperties

                                                                                                                                                                                                                                                            skipNullProperties?: boolean;
                                                                                                                                                                                                                                                            • If set to true then validator will skip validation of all properties that are null in the validating object.

                                                                                                                                                                                                                                                            property skipUndefinedProperties

                                                                                                                                                                                                                                                            skipUndefinedProperties?: boolean;
                                                                                                                                                                                                                                                            • If set to true then validator will skip validation of all properties that are undefined in the validating object.

                                                                                                                                                                                                                                                            property stopAtFirstError

                                                                                                                                                                                                                                                            stopAtFirstError?: boolean;
                                                                                                                                                                                                                                                            • When set to true, validation of the given property will stop after encountering the first error. Defaults to false.

                                                                                                                                                                                                                                                            property strictGroups

                                                                                                                                                                                                                                                            strictGroups?: boolean;

                                                                                                                                                                                                                                                            property validationError

                                                                                                                                                                                                                                                            validationError?: {
                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                            * Indicates if target should be exposed in ValidationError.
                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                            target?: boolean;
                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                            * Indicates if validated value should be exposed in ValidationError.
                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                            value?: boolean;
                                                                                                                                                                                                                                                            };
                                                                                                                                                                                                                                                            • ValidationError special options.

                                                                                                                                                                                                                                                            property whitelist

                                                                                                                                                                                                                                                            whitelist?: boolean;
                                                                                                                                                                                                                                                            • If set to true validator will strip validated object of any properties that do not have any decorators.

                                                                                                                                                                                                                                                              Tip: if no other decorator is suitable for your property use decorator.

                                                                                                                                                                                                                                                            Type Aliases

                                                                                                                                                                                                                                                            type ArrayUniqueIdentifier

                                                                                                                                                                                                                                                            type ArrayUniqueIdentifier<T = any> = (o: T) => any;

                                                                                                                                                                                                                                                              type IsIpVersion

                                                                                                                                                                                                                                                              type IsIpVersion = '4' | '6' | 4 | 6;

                                                                                                                                                                                                                                                                type IsISBNVersion

                                                                                                                                                                                                                                                                type IsISBNVersion = '10' | '13' | 10 | 13;

                                                                                                                                                                                                                                                                  type IsStrongPasswordOptions

                                                                                                                                                                                                                                                                  type IsStrongPasswordOptions = Pick<
                                                                                                                                                                                                                                                                  validator.StrongPasswordOptions,
                                                                                                                                                                                                                                                                  'minLength' | 'minLowercase' | 'minUppercase' | 'minNumbers' | 'minSymbols'
                                                                                                                                                                                                                                                                  >;
                                                                                                                                                                                                                                                                  • Options to be passed to IsStrongPassword decorator.

                                                                                                                                                                                                                                                                  Package Files (123)

                                                                                                                                                                                                                                                                  Dependencies (3)

                                                                                                                                                                                                                                                                  Dev Dependencies (0)

                                                                                                                                                                                                                                                                  No dev dependencies.

                                                                                                                                                                                                                                                                  Peer Dependencies (0)

                                                                                                                                                                                                                                                                  No peer dependencies.

                                                                                                                                                                                                                                                                  Badge

                                                                                                                                                                                                                                                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/class-validator.

                                                                                                                                                                                                                                                                  • Markdown
                                                                                                                                                                                                                                                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/class-validator)
                                                                                                                                                                                                                                                                  • HTML
                                                                                                                                                                                                                                                                    <a href="https://www.jsdocs.io/package/class-validator"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>