Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ValidationResult<T>

Wrapper class for post-validation changes to a BufferedProxy. All validator functions return an instance of this class, to allow for a single interface when updating the state of a BufferedProxy.

Type parameters

  • T

Hierarchy

  • ValidationResult

Index

Constructors

Properties

Accessors

Constructors

constructor

  • Creates a new instance of ValidationResult.

    new ValidationResult('name', 123, [
      { message: 'must be a string', validation: false },
      { message: 'must be at least 2 characters', validation: true }
    ]);

    Parameters

    Returns ValidationResult

Properties

key

key: ValidKey

The key being validated.

validatedResult.key; // 'name'

validations

validations: ValidationMeta[]

Result of the validations.

validationResult.validations;
[
  { message: 'must be a string', validation: false },
  { message: 'must be at least 2 characters', validation: true }
];

value

value: T

The value being validated.

validatedResult.value; // 'Lauren'

Accessors

isInvalid

  • get isInvalid(): boolean

isValid

  • get isValid(): boolean

messages

  • get messages(): string[]
  • Validation message for use in case of validation failure.

    validationResult.message; // 'key cannot be blank'

    Returns string[]

Generated using TypeDoc