Skip to content
New issue

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

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

Already on GitHub? # to your account

Simplify expression call inside falling through case #448

Open
hzlmn opened this issue Mar 1, 2017 · 0 comments
Open

Simplify expression call inside falling through case #448

hzlmn opened this issue Mar 1, 2017 · 0 comments

Comments

@hzlmn
Copy link
Contributor

hzlmn commented Mar 1, 2017

It is a feature request.
Currently this code sample

function bar(foo) {
  switch (foo) {
    case 'foo':
       log(a);
       log(b);
       log(c);
    case 'bar':
       return 2;
    default:
       return 0;
  }
}

converted to

function bar(foo) {
  switch (foo) {
    case 'foo':
       log(a), log(b), log(c);
     case 'bar':
       return 2;
     default:
       return 0;
  }
}

that could rather be converted to

function bar(foo) {
   return foo === 'foo' || foo === 'bar' ? (log(a), log(b), log(c), 2)  :  0;
}
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants