From c662c304931e1af74c8c37cae5c15f8f81a9cc76 Mon Sep 17 00:00:00 2001 From: Samuel Kwok Date: Mon, 6 Jul 2020 13:47:34 +0800 Subject: [PATCH] feat: export DEFAULT_COUNTRIES from defaultCountriesData feat: export DEFAULT_COUNTRIES from defaultCountriesData feat: export DEFAULT_COUNTRIES from defaultCountriesData (#320) --- README.md | 22 ++++++++++++++++++++++ src/components/AllCountries.js | 1 + src/index.js | 2 ++ 3 files changed, 25 insertions(+) diff --git a/README.md b/README.md index f24021f1f..7e3022bb3 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,28 @@ import 'react-intl-tel-input/dist/main.css'; Please see the [Demo Page](https://patw0929.github.io/react-intl-tel-input/) +### Default Countries + +List of default Countries can be imported as + +```javascript +import { DEFAULT_COUNTRIES } from 'react-intl-tel-input'; + +console.log(DEFAULT_COUNTRIES); +/* + [ + { + name: 'Afghanistan (‫افغانستان‬‎)', + iso2: 'af', + dialCode: '93', + priority: 0, + areaCodes: null, + }, + ... + ] +*/ +``` + ## Development (`src` and the build process) diff --git a/src/components/AllCountries.js b/src/components/AllCountries.js index 0f16b5ad7..3cc4b863d 100644 --- a/src/components/AllCountries.js +++ b/src/components/AllCountries.js @@ -374,4 +374,5 @@ const AllCountries = { getCountries, } +export const DEFAULT_COUNTRIES = _formatCountriesData(defaultCountriesData) export default AllCountries diff --git a/src/index.js b/src/index.js index 4d0a9e7db..198b1b77f 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,5 @@ import IntlTelInput from './components/IntlTelInput' +import { DEFAULT_COUNTRIES } from './components/AllCountries' +export { DEFAULT_COUNTRIES } export default IntlTelInput