Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if/else flattening in if branch #165

Open
Le0Developer opened this issue Mar 9, 2025 · 0 comments · May be fixed by #166
Open

if/else flattening in if branch #165

Le0Developer opened this issue Mar 9, 2025 · 0 comments · May be fixed by #166
Labels
enhancement New feature or request unminify

Comments

@Le0Developer
Copy link
Contributor

webcrack is able to successfully flatten if/else nesting in the else branch:

if(cond) {
  console.log("branch 1")
} else {
  if(cond2) {
    console.log("branch 2")
  } else {
    console.log("branch 3")
  }
}

becomes

if (cond) {
  console.log("branch 1");
} else if (cond2) {
  console.log("branch 2");
} else {
  console.log("branch 3");
}

but the inverse is not unflattened:

if (!cond) {
  if (cond2) {
    console.log("branch 2");
  } else {
    console.log("branch 3");
  }
} else {
  console.log("branch 1");
}
@Le0Developer Le0Developer added the enhancement New feature or request label Mar 9, 2025
@Le0Developer Le0Developer changed the title unminify if/else flattening in if branch if/else flattening in if branch Mar 9, 2025
@j4k0xb j4k0xb added the unminify label Mar 9, 2025
@Le0Developer Le0Developer linked a pull request Mar 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request unminify
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants