Util to get list of countries

This commit is contained in:
infinite-persistence 2021-04-01 16:45:12 +08:00 committed by Sean Yesmunt
parent dad75f76bd
commit fe885ae6de

18
ui/util/country.js Normal file
View file

@ -0,0 +1,18 @@
import { countries as countryData } from 'country-data';
export const COUNTRIES = Array.from(
new Set(
countryData.all
.filter((country) => country.status !== 'deleted')
.map((country) => country.name)
.sort((a, b) => {
if (a > b) {
return 1;
}
if (b > a) {
return -1;
}
return 0;
})
)
);