Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2k
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
e803c5ea31d3603067e6d238ac94767412cc56931386002d2d33e9c949fac99File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| 'use strict'; | ||
| var d3 = require('@plotly/d3'); | ||
| var { area: turfArea } = require('@turf/area'); | ||
| var { centroid: turfCentroid } = require('@turf/centroid'); | ||
| var { bbox: turfBbox } = require('@turf/bbox'); | ||
| @@ -12,8 +11,8 @@ var isPlainObject = require('./is_plain_object'); | ||
| var nestedProperty = require('./nested_property'); | ||
| var polygon = require('./polygon'); | ||
| const countries = require("i18n-iso-countries"); | ||
| ||
| countries.registerLocale(require("i18n-iso-countries/langs/en.json")); | ||
| var locationmodeToIdFinder = { | ||
| 'ISO-3': identity, | ||
| @@ -22,11 +21,12 @@ var locationmodeToIdFinder = { | ||
| }; | ||
| function countryNameToISO3(countryName) { | ||
| // remove sequences of whitespaces | ||
| var cleanName = countryName.replace(/\s+/g, ' ').trim(); | ||
| var alpha3Code = countries.getAlpha3Code(cleanName, "en") | ||
| if (alpha3Code !== undefined) { | ||
| return alpha3Code; | ||
| } | ||
| loggers.log('Unrecognized country name: ' + countryName + '.'); | ||