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

Hierarchy

  • Predicate<number>
    • NumberPredicate

Implements

  • BasePredicate<number>

Index

Accessors

finite

finite:

Test a number to be finite.

infinite

infinite:

Test a number to be infinite.

integer

integer:

Test a number to be an integer.

negative

negative:

Test a number to be negative.

not

not:

Invert the following validators.

positive

positive:

Test a number to be positive.

Methods

equal

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

    Parameters

    • expected: number

      Expected value to match.

    Returns this

greaterThan

  • greaterThan(x: number): this
  • Test a number to be greater than the provided value.

    Parameters

    • x: number

      Minimum value.

    Returns this

greaterThanOrEqual

  • greaterThanOrEqual(x: number): this
  • Test a number to be greater than or equal to the provided value.

    Parameters

    • x: number

      Minimum value.

    Returns this

inRange

  • inRange(start: number, end: number): this
  • Test a number to be in a specified range.

    Parameters

    • start: number

      Start of the range.

    • end: number

      End of the range.

    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: number): boolean | string
        • Parameters

          • value: number

          Returns boolean | string

    Returns this

lessThan

  • lessThan(x: number): this
  • Test a number to be less than the provided value.

    Parameters

    • x: number

      Maximum value.

    Returns this

lessThanOrEqual

  • lessThanOrEqual(x: number): this
  • Test a number to be less than or equal to the provided value.

    Parameters

    • x: number

      Minimum value.

    Returns this