Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ObjectComparator

Helper class to perform comparison operations over arbitrary values.

Example

ObjectComparator.compare(2, "GT", 1);        // Result: true
ObjectComparator.areEqual("A", "B");         // Result: false

Hierarchy

  • ObjectComparator

Index

Methods

Static areEqual

  • areEqual(value1: any, value2: any): boolean
  • Checks if two values are equal. The operation can be performed over values of any type.

    Parameters

    • value1: any

      the first value to compare

    • value2: any

      the second value to compare

    Returns boolean

    true if values are equal and false otherwise

Static areNotEqual

  • areNotEqual(value1: any, value2: any): boolean
  • Checks if two values are NOT equal The operation can be performed over values of any type.

    Parameters

    • value1: any

      the first value to compare

    • value2: any

      the second value to compare

    Returns boolean

    true if values are NOT equal and false otherwise

Static compare

  • compare(value1: any, operation: string, value2: any): boolean
  • Perform comparison operation over two arguments. The operation can be performed over values of any type.

    Parameters

    • value1: any

      the first argument to compare

    • operation: string

      the comparison operation: "==" ("=", "EQ"), "!= " ("<>", "NE"); "<"/">" ("LT"/"GT"), "<="/">=" ("LE"/"GE"); "LIKE".

    • value2: any

      the second argument to compare

    Returns boolean

    result of the comparison operation

Static isGreater

  • isGreater(value1: any, value2: any): boolean
  • Checks if first value is greater than the second one. The operation can be performed over numbers or strings.

    Parameters

    • value1: any

      the first value to compare

    • value2: any

      the second value to compare

    Returns boolean

    true if the first value is greater than second and false otherwise.

Static isLess

  • isLess(value1: any, value2: any): boolean
  • Checks if first value is less than the second one. The operation can be performed over numbers or strings.

    Parameters

    • value1: any

      the first value to compare

    • value2: any

      the second value to compare

    Returns boolean

    true if the first value is less than second and false otherwise.

Static match

  • match(value: any, regexp: any): boolean
  • Checks if string matches a regular expression

    Parameters

    • value: any

      a string value to match

    • regexp: any

      a regular expression string

    Returns boolean

    true if the value matches regular expression and false otherwise.

Generated using TypeDoc