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

Hierarchy

  • Predicate<any>
    • ObjectPredicate

Implements

  • BasePredicate<any>

Index

Constructors

constructor

Accessors

empty

empty:

Test an object to be empty.

nonEmpty

nonEmpty:

Test an object to be not empty.

not

not:

Invert the following validators.

plain

plain:

Test if an Object is a plain object.

Methods

deepEqual

  • deepEqual(expected: object): this
  • Test an object to be deeply equal to the provided object.

    Parameters

    • expected: object

      Expected object to match.

    Returns this

deepValuesOfType

  • deepValuesOfType<T>(predicate: Predicate<T>): this
  • Test all the values in the object deeply to match the provided predicate.

    Type parameters

    • T

    Parameters

    • predicate: Predicate<T>

      The predicate that should be applied against every value in the object.

    Returns this

hasAnyKeys

  • hasAnyKeys(...keys: string[]): this
  • Test an object to include any of the provided keys. You can use dot-notation in a key to access nested properties.

    Parameters

    • Rest ...keys: string[]

      The keys that could be a key in the object.

    Returns this

hasKeys

  • hasKeys(...keys: string[]): this
  • Test an object to include all the provided keys. You can use dot-notation in a key to access nested properties.

    Parameters

    • Rest ...keys: string[]

      The keys that should be present in the object.

    Returns this

instanceOf

  • instanceOf(instance: any): this
  • Test an object to be of a specific instance type.

    Parameters

    • instance: any

      The expected instance type of the object.

    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

valuesOfType

  • valuesOfType<T>(predicate: Predicate<T>): this
  • Test all the values in the object to match the provided predicate.

    Type parameters

    • T

    Parameters

    • predicate: Predicate<T>

      The predicate that should be applied against every value in the object.

    Returns this