Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Objects

Utilities for comparing, equating, and hashing structural values. A structural value is typed by object structure, rather than by name.

Hierarchy

  • Objects

Index

Methods

Static compare

  • compare(x: unknown, y: unknown): 0 | 1 | -1
  • Returns the relative order of two structural values. Returns -1 if x orders before y; returns 1 if x orders after y; returns 0 if x and y are equivalent; and returns NaN if x is not comparable to y.

    Parameters

    • x: unknown
    • y: unknown

    Returns 0 | 1 | -1

Static compareArray

  • compareArray(x: Array<unknown>, y: Array<unknown>): 0 | 1 | -1
  • Returns the relative order of two arrays of structural values. Returns -1 if x orders before y; returns 1 if x orders after y; returns 0 if x and y are equivalent; and returns NaN if x is not comparable to y.

    Parameters

    • x: Array<unknown>
    • y: Array<unknown>

    Returns 0 | 1 | -1

Static compareObject

  • compareObject(x: Object, y: Object): 0 | 1 | -1
  • Returns the relative order of two structural objects. Returns -1 if x orders before y; returns 1 if x orders after y; returns 0 if x and y are equivalent; and returns NaN if x is not comparable to y.

    Parameters

    • x: Object
    • y: Object

    Returns 0 | 1 | -1

Static equal

  • equal(x: unknown, y: unknown): boolean
  • Compares two structural values for equality. Returns true if x and y are structurally equal, otherwise returns false.

    Parameters

    • x: unknown
    • y: unknown

    Returns boolean

Static equalArray

  • equalArray(x: Array<unknown>, y: Array<unknown>): boolean
  • Compares two arrays of structural values for equality. Returns true if x and y are structurally equal, otherwise returns false.

    Parameters

    • x: Array<unknown>
    • y: Array<unknown>

    Returns boolean

Static equalObject

  • equalObject(x: Object, y: Object): boolean
  • Compares two structural objects for equality. Returns true if x and y are structurally equal, otherwise returns false.

    Parameters

    • x: Object
    • y: Object

    Returns boolean

Static hash

  • hash(x: unknown): number

Static hashArray

  • hashArray(x: Array<unknown>): number

Static hashObject

  • hashObject(x: Object): number