ow
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Predicate<string>
    • StringPredicate

Implements

  • BasePredicate<string>

Index

Accessors

alphanumeric

alphanumeric:

Test a string to be alphanumeric.

date

date:

Test a string to be a valid date.

empty

empty:

Test a string to be empty.

nonEmpty

nonEmpty:

Test a string to be not empty.

not

not:

Invert the following validators.

numeric

numeric:

Test a string to be numeric.

Methods

endsWith

  • endsWith(searchString: string): this
  • Test a string to end with a specific value.

    Parameters

    • searchString: string

      The value that should be the end of the string.

    Returns this

equals

  • equals(expected: string): this
  • Test a string to be equal to a specified string.

    Parameters

    • expected: string

      Expected value to match.

    Returns this

includes

  • includes(searchString: string): this
  • Test a string to include a specific value.

    Parameters

    • searchString: string

      The value that should be included in the string.

    Returns this

is

  • is(fn: function): this
  • Test if the value matches a custom validation function. The validation function should return true if the value passes the function. If the function either returns false or a string, the function fails and the string will be used as error message.

    Parameters

    • fn: function

      Validation function.

        • (value: string): boolean | string
        • Parameters

          • value: string

          Returns boolean | string

    Returns this

length

  • length(length: number): this
  • Test a string to have a specific length.

    Parameters

    • length: number

      The length of the string.

    Returns this

matches

  • matches(regExp: RegExp): this

maxLength

  • maxLength(length: number): this
  • Test a string to have a maximum length.

    Parameters

    • length: number

      The maximum length of the string.

    Returns this

minLength

  • minLength(length: number): this
  • Test a string to have a minimum length.

    Parameters

    • length: number

      The minimum length of the string.

    Returns this

startsWith

  • startsWith(searchString: string): this
  • Test a string to start with a specific value.

    Parameters

    • searchString: string

      The value that should be the start of the string.

    Returns this