Provides conditional logic functions for use within HotMesh mapping rules. Although inspired by JavaScript operators, these methods have been adapted to follow a functional approach. Each transformation is a function that expects one or more input parameters from the prior row in the @pipe structure.

Invoked via {@conditional.<method>} in YAML mapping rules.

Constructors

Methods

  • Checks whether two values are equal using non-strict equality (==). Type coercion is applied, so 42 == "42" returns true.

    Parameters

    • value1: any

      The first value to compare

    • value2: any

      The second value to compare

    Returns boolean

    True if the values are loosely equal, otherwise false

    are_values_equal:
    "@pipe":
    - ["{a.data.value1}", "{a.data.value2}"]
    - ["{@conditional.equality}"]
  • Checks whether the first value is greater than the second value.

    Parameters

    • value1: number

      The first number to compare

    • value2: number

      The second number to compare

    Returns boolean

    True if value1 is greater than value2, otherwise false

    is_greater:
    "@pipe":
    - ["{a.data.value1}", "{a.data.value2}"]
    - ["{@conditional.greater_than}"]
  • Checks whether the first value is greater than or equal to the second value.

    Parameters

    • value1: number

      The first number to compare

    • value2: number

      The second number to compare

    Returns boolean

    True if value1 is greater than or equal to value2, otherwise false

    is_gte:
    "@pipe":
    - ["{a.data.value1}", "{a.data.value2}"]
    - ["{@conditional.greater_than_or_equal}"]
  • Checks whether two values are not equal using non-strict inequality (!=). Type coercion is applied, so 42 != "42" returns false.

    Parameters

    • value1: any

      The first value to compare

    • value2: any

      The second value to compare

    Returns boolean

    True if the values are not loosely equal, otherwise false

    are_values_not_equal:
    "@pipe":
    - ["{a.data.value1}", "{a.data.value2}"]
    - ["{@conditional.inequality}"]
  • Checks whether the first value is less than the second value.

    Parameters

    • value1: number

      The first number to compare

    • value2: number

      The second number to compare

    Returns boolean

    True if value1 is less than value2, otherwise false

    is_less:
    "@pipe":
    - ["{a.data.value1}", "{a.data.value2}"]
    - ["{@conditional.less_than}"]
  • Checks whether the first value is less than or equal to the second value.

    Parameters

    • value1: number

      The first number to compare

    • value2: number

      The second number to compare

    Returns boolean

    True if value1 is less than or equal to value2, otherwise false

    is_lte:
    "@pipe":
    - ["{a.data.value1}", "{a.data.value2}"]
    - ["{@conditional.less_than_or_equal}"]
  • Returns the first value if it is not null or undefined, otherwise returns the second value. Equivalent to the JavaScript nullish coalescing operator (??). Unlike logical OR, this allows falsy values like 0 and false to pass through.

    Parameters

    • value1: any

      The value to test for null/undefined

    • value2: any

      The fallback value if value1 is null or undefined

    Returns any

    value1 if it is not null/undefined, otherwise value2

    non_null_value:
    "@pipe":
    - ["{a.data.value1}", "{a.data.value2}"]
    - ["{@conditional.nullish}"]
  • Checks whether two values are equal using strict equality (===). No type coercion is applied, so 42 === "42" returns false.

    Parameters

    • value1: any

      The first value to compare

    • value2: any

      The second value to compare

    Returns boolean

    True if the values are strictly equal, otherwise false

    are_values_strictly_equal:
    "@pipe":
    - ["{a.data.value1}", "{a.data.value2}"]
    - ["{@conditional.strict_equality}"]
  • Checks whether two values are not equal using strict inequality (!==). No type coercion is applied, so 42 !== "42" returns true.

    Parameters

    • value1: any

      The first value to compare

    • value2: any

      The second value to compare

    Returns boolean

    True if the values are strictly not equal, otherwise false

    are_values_strictly_not_equal:
    "@pipe":
    - ["{a.data.value1}", "{a.data.value2}"]
    - ["{@conditional.strict_inequality}"]
  • Evaluates a condition and returns one of two provided values based on the result. Equivalent to the JavaScript ternary operator (condition ? valueIfTrue : valueIfFalse).

    Parameters

    • condition: boolean

      The condition to evaluate

    • valueIfTrue: any

      The value to return if the condition is true

    • valueIfFalse: any

      The value to return if the condition is false

    Returns any

    The value corresponding to the condition result

    status_label:
    "@pipe":
    - ["{a.data.isActive}", "{a.data.activeLabel}", "{a.data.inactiveLabel}"]
    - ["{@conditional.ternary}"]