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

Hierarchy

  • Predicate<any[]>
    • ArrayPredicate

Implements

  • BasePredicate<any[]>

Index

Accessors

empty

empty:

Test an array to be empty.

nonEmpty

nonEmpty:

Test an array to be not empty.

not

not:

Invert the following validators.

Methods

deepEqual

  • deepEqual(expected: any[]): this
  • Test an array to be deeply equal to the provided array.

    Parameters

    • expected: any[]

      Expected value to match.

    Returns this

endsWith

  • endsWith(searchElement: any): this
  • Test an array to end with a specific value. The value is tested by identity, not structure.

    Parameters

    • searchElement: any

      The value that should be the end of the array.

    Returns this

includes

  • includes(...searchElements: any[]): this
  • Test an array to include all the provided elements. The values are tested by identity, not structure.

    Parameters

    • Rest ...searchElements: any[]

      The values that should be included in the array.

    Returns this

includesAny

  • includesAny(...searchElements: any[]): this
  • Test an array to include any of the provided elements. The values are tested by identity, not structure.

    Parameters

    • Rest ...searchElements: any[]

      The values that should be included in the array.

    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: any[]): boolean | string
        • Parameters

          • value: any[]

          Returns boolean | string

    Returns this

length

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

    Parameters

    • length: number

      The length of the array.

    Returns this

maxLength

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

    Parameters

    • length: number

      The maximum length of the array.

    Returns this

minLength

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

    Parameters

    • length: number

      The minimum length of the array.

    Returns this

ofType

  • ofType<T>(predicate: Predicate<T>): this
  • Test all elements in the array to match to provided predicate.

    Type parameters

    • T

    Parameters

    • predicate: Predicate<T>

      The predicate that should be applied against every individual item.

    Returns this

startsWith

  • startsWith(searchElement: any): this
  • Test an array to start with a specific value. The value is tested by identity, not structure.

    Parameters

    • searchElement: any

      The value that should be the start of the array.

    Returns this