@cowwoc/requirements - v4.0.12
    Preparing search index...

    Interface NumberComponent<T>

    Methods that all number validators must contain.

    interface NumberComponent<T extends number | undefined | null> {
        getValue(): T;
        isBetween(minimumInclusive: number, maximumExclusive: number): this;
        isBetween(
            minimum: number,
            minimumInclusive: boolean,
            maximum: number,
            maximumInclusive: boolean,
        ): this;
        isFinite(): this;
        isGreaterThan(minimumExclusive: number): this;
        isGreaterThan(minimumExclusive: number, name: string): this;
        isGreaterThanOrEqualTo(minimumInclusive: number): this;
        isGreaterThanOrEqualTo(minimumInclusive: number, name: string): this;
        isInfinite(): this;
        isLessThan(maximumExclusive: number): this;
        isLessThan(maximumExclusive: number, name: string): this;
        isLessThanOrEqualTo(maximumInclusive: number): this;
        isLessThanOrEqualTo(maximumInclusive: number, name: string): this;
        isMultipleOf(factor: number): this;
        isMultipleOf(factor: number, name: string): this;
        isNotMultipleOf(factor: number): this;
        isNotMultipleOf(factor: number, name: string): this;
        isNotNumber(): this;
        isNumber(): this;
    }

    Type Parameters

    • T extends number | undefined | null

      the type of the value

    Hierarchy (View Summary)

    Index

    Methods

    • Ensures that the value is within a range.

      Parameters

      • minimumInclusive: number

        the lower bound of the range (inclusive)

      • maximumExclusive: number

        the upper bound of the range (exclusive)

      Returns this

      this

      TypeError if the value or any of the arguments are undefined or null

      RangeError if minimumInclusive is greater than maximumExclusive. If the value is less than minimumInclusive. If the value is greater than or equal to maximumExclusive.

    • Ensures that the value is within a range.

      Parameters

      • minimum: number

        the lower bound of the range

      • minimumInclusive: boolean

        true if the lower bound of the range is inclusive

      • maximum: number

        the upper bound of the range

      • maximumInclusive: boolean

        true if the upper bound of the range is inclusive

      Returns this

      this

      TypeError if the value or any of the arguments are undefined or null

      RangeError if minimum is greater than maximum. If minimumInclusive is true, and the value is less than minimum. If minimumInclusive is false, and the value is less than or equal to minimum. If maximumInclusive is true and the value is greater than maximum. If maximumInclusive is false, and the value is greater than or equal to maximum.

    • Ensures that the value is a finite number.

      Returns this

      this

      TypeError if the value is undefined or null

      RangeError if value is not a number or is an infinite number

      • isNumber
      • Number.isFinite
    • Ensures that the value is greater than a lower bound.

      Parameters

      • minimumExclusive: number

        the exclusive lower bound

      Returns this

      this

      TypeError if the value or minimumExclusive are undefined or null

      RangeError if the value is less than minimumExclusive

    • Ensures that the value is greater than a lower bound.

      Parameters

      • minimumExclusive: number

        the exclusive lower bound

      • name: string

        the name of the lower bound

      Returns this

      this

      TypeError if the value or any of the arguments are undefined or null

      RangeError if name contains whitespace or is empty. If the value is less than minimumExclusive.

    • Ensures that the value is greater than or equal to a minimum value.

      Parameters

      • minimumInclusive: number

        the minimum value

      Returns this

      this

      TypeError if the value or minimumInclusive are undefined or null

      RangeError if the value is less than minimumInclusive

    • Ensures that the value is greater than or equal a minimum value.

      Parameters

      • minimumInclusive: number

        the minimum value

      • name: string

        the name of the minimum value

      Returns this

      this

      TypeError if the value or any of the arguments are undefined or null

      RangeError if name contains whitespace or is empty. If the value is less than minimumInclusive.

    • Ensures that the value is an infinite number.

      Returns this

      this

      TypeError if the value is undefined or null

      RangeError if value is not a number or is a finite number

      • isNumber
      • Number.isFinite
    • Ensures that the value is less than an upper bound.

      Parameters

      • maximumExclusive: number

        the exclusive upper bound

      Returns this

      this

      TypeError if the value or maximumExclusive are undefined or null

      RangeError if the value is greater than or equal to maximumExclusive

    • Ensures that the value is less than an upper bound.

      Parameters

      • maximumExclusive: number

        the exclusive upper bound

      • name: string

        the name of the upper bound

      Returns this

      this

      TypeError if the value or any of the arguments are undefined or null

      RangeError if name contains a leading, trailing whitespace or is empty. If the value is greater than or equal to maximumExclusive.

    • Ensures that the value is less than or equal to a maximum value.

      Parameters

      • maximumInclusive: number

        the inclusive upper value

      Returns this

      this

      TypeError if the value or maximumInclusive are undefined or null

      RangeError if the value is greater than maximumInclusive

    • Ensures that the value is less than or equal to a maximum value.

      Parameters

      • maximumInclusive: number

        the maximum value

      • name: string

        the name of the maximum value

      Returns this

      this

      TypeError if the value or any of the arguments are undefined or null

      RangeError if name contains whitespace or is empty. If the value is greater than maximumInclusive.

    • Ensures that the value is a multiple of factor.

      Parameters

      • factor: number

        the number being multiplied

      Returns this

      this

      TypeError if the value or factor are undefined or null

      RangeError if the value is not a multiple of factor

    • Ensures that the value is a multiple of factor.

      Parameters

      • factor: number

        the number being multiplied

      • name: string

        the name of the factor

      Returns this

      this

      TypeError if the value or any of the arguments are undefined or null

      RangeError if name contains whitespace or is empty. If the value is not a multiple of factor.

    • Ensures that the value is not a multiple of factor.

      Parameters

      • factor: number

        the number being multiplied

      Returns this

      this

      TypeError if the value or factor are undefined or null

      RangeError if the value is a multiple of factor

    • Ensures that the value is not a multiple of factor.

      Parameters

      • factor: number

        the number being multiplied

      • name: string

        the name of the factor

      Returns this

      this

      TypeError if the value or any of the arguments are undefined or null

      RangeError if name contains whitespace or is empty. If the value is a multiple of factor.

    • Ensures that the value is the result of a mathematically undefined numerical operation (such as division by zero) or don't have a representation in real numbers (such as the square-root of -1).

      Returns this

      this

      NullPointerError if the value is undefined or null

      RangeError if value is a well-defined number

    • Ensures that the value is a well-defined number.

      Returns this

      this

      TypeError if the value is undefined or null

      RangeError if value is not a well-defined number

      isNotNumber