Variable stringValidatorsConst

stringValidators: {
    matches(regex: RegExp): Validator<string, string>;
    maxLength(max: number): Validator<string, string>;
    minLength(min: number): Validator<string, string>;
    noWhitespace(): Validator<string, string>;
    notEmpty(): Validator<string, string>;
} = ...

Type declaration

  • matches:function
    • Creates a validator that asserts that the input string matches the given regex.

      Parameters

      • regex: RegExp

      Returns Validator<string, string>

  • maxLength:function
    • Creates a validator that asserts that the input string has at most the given maximum length.

      Parameters

      • max: number

        The string must be at most this length.

      Returns Validator<string, string>

  • minLength:function
    • Creates a validator that asserts that the input string has at least the given minimum length.

      Parameters

      • min: number

        The string must be at least this length.

      Returns Validator<string, string>

  • noWhitespace:function
    • Creates a validator that asserts that the input string has no whitespace characters. Whitespace characters include space, new line, carriage return, and tab.

      Returns Validator<string, string>

  • notEmpty:function
    • Creates a validator that asserts that the input is not empty.

      Returns Validator<string, string>