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

Useless switch #4

Open
RudeySH opened this issue Mar 14, 2017 · 3 comments
Open

Useless switch #4

RudeySH opened this issue Mar 14, 2017 · 3 comments

Comments

@RudeySH
Copy link

RudeySH commented Mar 14, 2017

I found this switch in the source code:

switch (country_code) {     
  case "AT":
    if (country_code == "AT") {
      valid_country = true;
    }
   break;        
  case "BE":
    if (country_code == "BE") {
      valid_country = true;
    }
    break;
    
    // ... etc. ...
    
  default:
    valid_country = false;
    break;
}

This seems fairly useless.

@nolialsea
Copy link

It IS useless, and even worse, on line 197-199, the country_code can NEVER be "GF"/"PF"/"TF"

@RudeySH
Copy link
Author

RudeySH commented Apr 4, 2017

What the hell.

Anyway, this should be replaced with something simple like this:

var known_codes = ["AT", "BE", ...];
valid_country = (known_codes.indexOf(country_code) !== -1);

@jbilcke
Copy link
Contributor

jbilcke commented Apr 5, 2017

it looks like the skeleton of an older, more living switch:
c362076

I don't remember exactly why I left it in the closet, but that definitely should have been cleaned up

however this fork has not been updated for 3 years, so I think it would be better to use the original http://www.braemoor.co.uk/software/vat.shtml which has been updated since that time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants