• Function to apply unary or binary operators to boolean values. Logical operators supported: and, or, not, xor.

    Parameters

    • operator: string

      Operator to apply.

    • a: boolean

      First boolean value.

    • Optional b: boolean

      Second boolean value (optional, only used for binary operators).

    Returns boolean

    The boolean value after applying the operator.

    Example

    // Example usage:
    import { applyOperator } from "@zk-kit/logical-expressions"

    // Unary operator
    const result1 = applyOperator("not", true)
    console.log(result1) // Output: false

    // Binary operator
    const result2 = applyOperator("and", true, false)
    console.log(result2) // Output: false