therebelrobot / countryjs

[unmaintained] A module for returning data about countries, ISO info and states/provinces within them. Browserify-compatible
http://country.js.org
120 stars 88 forks source link

country.nativeName('GB') returns undefined because multiple countries use the same ISO code #26

Closed teddyhwang closed 9 years ago

teddyhwang commented 9 years ago

United Kingdom and Scotland has the same ISO code of GB and GBR. Any countries that call upon GB conflict with the two entries and the Scotland data is returned first.

therebelrobot commented 9 years ago

Fair enough. I was unaware that multiple countries could have the same ISO code. That call should probably return an array of countries, rather than a single object. I'll take a look at that today.

teddyhwang commented 9 years ago

FYI, there are several other calls (e.g country.name) that would have the same problem.

therebelrobot commented 9 years ago

I am aware. The fix I'm rolling would effect all searches.

teddyhwang commented 9 years ago

:+1:

therebelrobot commented 9 years ago

Also, be aware, we also have a possibly large API change in the works, the fix for this will most likely be rolled with that one. refer #19

therebelrobot commented 9 years ago

A fix for this has been pushed into the release/2.0.0-alpha branch. Feel free to use that branch if you need the change quickly, but as it entails a major API change, I can't publish it just yet to NPM. Once we've finished up the work in #19, I'll roll v2.0.0 to a full release.