Skip to content

Replace country-regex with i18n-iso-countries #7366

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dimitrov570
Copy link

Resolves the issue discussed in #7026.

This implementation does not use regular expressions as before and does not contain countries that do not exist anymore, compared to the previous solution with country-regex. But on the other hand i18n-iso-countries seems to be updated frequently, so it will contain updated information on country codes.

@gvwilson gvwilson added community community contribution P1 needed for current cycle fix fixes something broken labels Feb 18, 2025
@gvwilson
Copy link
Contributor

thanks @dimitrov570 - I'll see if we can get this into the 3.1 release.

Copy link
Contributor

@camdecoster camdecoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I left a few comments. Could you please merge master and handle the merge conflicts?

@gvwilson there are 6 codes removed from the new package. Would this count as a breaking change? The countries don't exist anymore.

Code Country
ANT Netherlands Antilles
CSK Czechoslovakia
DDR German Democratic Republic
EAZ Zanzibar
YMD South Yemen
YUG Yugoslavia

@@ -0,0 +1 @@
- Replace country-regex with i18n-iso-countries [[#7366](https://github.com/plotly/plotly.js/pull/7366)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Replace country-regex with i18n-iso-countries [[#7366](https://github.com/plotly/plotly.js/pull/7366)]
- Replace country-regex package with i18n-iso-countries [[#7366](https://github.com/plotly/plotly.js/pull/7366)]

@@ -12,8 +11,8 @@ var isPlainObject = require('./is_plain_object');
var nestedProperty = require('./nested_property');
var polygon = require('./polygon');

// make list of all country iso3 ids from at runtime
var countryIds = Object.keys(countryRegex);
const countries = require("i18n-iso-countries");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please move this require statement above with the others?

@gvwilson
Copy link
Contributor

I don't think the deleted countries counts as a breaking change.

@camdecoster camdecoster self-requested a review July 30, 2025 20:00
@camdecoster
Copy link
Contributor

I clicked the wrong button. Let me know when you make changes and I'll review again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community contribution fix fixes something broken P1 needed for current cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants