Options
All
  • Public
  • Public/Protected
  • All
Menu

Validation is a utility class for creating a chain of validation rules.

Hierarchy

  • Validation

Index

Constructors

constructor

Properties

Private rules

rules: ValidationFunction[] = []

Methods

between

  • Add rule that the value must be a number between min and max (inclusive)

    Parameters

    • min: number

      Minimum inclusive value

    • max: number

      Maximum inclusive value

    Returns Validation

    Returns true if the value is a number between given min and max

get

max

  • Add rule that the value must be a number and maximum max (inclusive)

    Parameters

    • max: number

      Maximum inclusive value

    Returns Validation

    Returns true if the value is a number and maximum given max

min

  • Add rule that the value must be a number and minimum min (inclusive)

    Parameters

    • min: number

      Minimum inclusive value

    Returns Validation

    Returns true if the value is a number and minimum given min

number

  • Add rule that the value must be a number

    Parameters

    • validationMessage: string = VALIDATION_MESSAGES.NUMBER

      Optional specific validation message for the UI

    Returns Validation

    Returns true if the value is a number

required

  • Add required rule for validation chain

    Parameters

    • validationMessage: string = VALIDATION_MESSAGES.REQUIRED

      Optional specific validation message for the UI

    Returns Validation

    Returns true if the value is set

validate

Generated using TypeDoc