def format_match(
    cond: str | Var,
    match_cases: list[list[Var]],
    default: Var,
) -> str:
    """Format a match expression whose return type is a Var.

    Args:
        cond: The condition.
        match_cases: The list of cases to match.
        default: The default case.

    Returns:
        The formatted match expression

    """
    switch_code = f"(() => {{ switch (JSON.stringify({cond})) {{"

    for case in match_cases:
        conditions = case[:-1]
        return_value = case[-1]

        case_conditions = " ".join(
            [f"case JSON.stringify({condition!s}):" for condition in conditions]
        )
        case_code = f"{case_conditions}  return ({return_value!s});  break;"
        switch_code += case_code

    switch_code += f"default:  return ({default!s});  break;"
    switch_code += "};})()"

    return switch_code
Format a match expression whose return type is a Var.

    Args:
        cond: The condition.
        match_cases: The list of cases to match.
        default: The default case.

    Returns:
        The formatted match expression

    
reflex/utils/format.py