Variable NumbersConst

Numbers: {
    hash: ((x) => number);
    compare(x, y) => number;
    equal(x, y) => boolean;
    equivalent(x, y, epsilon?) => boolean;
    fromLike<T>(value) => number | Uninitable<T>;
}

Utilities for comparing and hashing numbers.

Type declaration

  • hash: ((x) => number)
      • (x): number
      • Returns a 32-bit hash value for the number x, if defined; otherwise returns 0 or 1 if x is undefined or null, respectively.

        Parameters

        • x: number | null | undefined

        Returns number

  • compare:function
    • Returns the relative order of x with respect to y. Returns -1 if the number x less than the number y; returns 1 if the number x is greater than the number y; and returns 0 if x and y are equal numbers, or if both are NaN. If either x or y is NaN, null, or undefined, then numbers order before NaN, NaN orders before null, and null orders before undefined.

      Parameters

      • x: number
      • y: number

      Returns number

  • equal:function
    • Returns true if x and y are equal numbers, or if both are NaN; otherwise returns x === y if either x or y is not defined.

      Parameters

      • x: number
      • y: number

      Returns boolean

  • equivalent:function
    • Returns true if x and y are both defined, and the difference between the two is less than epsilon, or if both are NaN; otherwise returns x === y if either x or y is not defined.

      Parameters

      • x: number
      • y: number
      • Optional epsilon: number

      Returns boolean

  • fromLike:function
    • Type Parameters

      • T extends string | number | boolean

      Parameters

      • value: T

      Returns number | Uninitable<T>

Generated using TypeDoc