Country codes usage example

windows.countries available in console for test purposes

import countries from 'countries-3166';

/* Alpha-3 (default) */
countries.values(); //returns countries data (object) run
countries.toArray(); //returns countries data (array) run

/* Alpha-2 */
countries.alpha2().values(); //returns countries alpha-2 data (object) run
countries.alpha2().toArray(); //returns countries alpha-2 data (array) run

/* Translations */
countries.translate('UKR').values(); //returns translated countries data (object) run
countries.translate('ua').alpha2().toArray(); //returns countries translated alpha-2 data (array) run

/* Sorting */
countries.sortByKey().values(); //returns sorted by key countries data (object) run
countries.translate('UKR').sortByName().toArray(); //returns sorted by name translated countries data (object) run
//NOTE: Object's order may displays wrong in console

/* Favorite Countries */
countries.translate('UKR').sortByName().favorites('UKR').values(); //returns sorted by countries data with Ukraine country at the first place (object) run

* See output in console