• Function to determine the precedence of operators. Unary operators have higher precedence. Binary operators have the same precedence.

    Parameters

    • operator: string

      Operator to check the precedence.

    Returns number

    The precedence of the operator or 0 if the operator is not supported

    Example

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

    const result = precedence("and")

    console.log(result) // Output: 1