Converts a switch statement into either consecutive statements or if statements

  • If the switch has only one clause and a default case, it is converted to consecutive statements
  • Otherwise, it is converted to if statements

Constructors

Methods

  • Converts a switch statement to consecutive statements or if statements

    Parameters

    • switchStmt: Switch

      The switch statement to convert

    Returns undefined | Statement

    The converted statements or undefined if no statements remain

  • Converts a switch with only one clause and a default case into consecutive statements

    Parameters

    • switchStmt: Switch

      The switch statement to convert

    Returns undefined | Statement

    The first statement or undefined if no statements remain

  • Converts a switch statement into a series of if statements

    Parameters

    • switchStmt: Switch

      The switch statement to convert

    Returns If

    The first if statement created