
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
react-simple-phone-input
Advanced tools
A simple react phone input component with calling code dropdown🤷
A node js package to get country data including country name, code, currency information, emoji etc.
A simple but useful functional node packages with all country data. It includes all useful country data gives several function to complete your project.
The data currently provided for each country is:
id
The unique id number for the array
name
The english name for the country
isoAlpha2
The ISO 3166-1 alpha 2 code
isoAlpha3
The ISO 3166-1 alpha 3 code
isoNumeric
The ISO 3166-1 numeric
currency
An object with currency info.
code
The ISO 4217 currency codesname
The currency namesymbol
The currency symbolflag
Country flag base64 data
languages
An array of ISO 639-2 codes for languages.
countryCallingCodes
The international call prefixes for this country.
emoji
The emoji of country's flag.
$ npm i country-data-codes
import { getCountryList } from "country-data-codes";
or
const { getCountryList } = require("country-data-codes")
Example
console.log(getCountryList()); //Returns all country list
Returns the country's currency info by providing country code.
Example
import { getCurrency, GetCurrencyTypes } from "country-data-codes";
const currencyInfo: GetCurrencyTypes = getCurrency("BD"); // Here country code can be isoAlpha2 or isoAlpha3
console.log(currencyInfo)
Return values-
name
currency namecode
currency codesymbol
currency symbolReturns the country's calling code. It returns an array of string.
Example
import { getCallingCode, GetCallingCodeTypes } from "country-data-codes";
const dialingCode: GetCallingCodeTypes = getCallingCode("BD")
console.log(dialingCode) // Give the country code(isoAlpha2 or isoAlpha3)
//{
code: "880",
format: "+880",
flag: "" //Base64 flash data
}
Returns the country's languages. It returns an array of string;
Example
import { getLanguages } from "country-data-codes";
console.log(getLanguages("BD")) // Give the country code(isoAlpha2 or isoAlpha3)
//["ben"]
Returns the country's flag image as base64 data
Example
import { getFlagBase64 } from "country-data-codes";
const flag = getFlagBase64("BD") // Give the country code(isoAlpha2 or isoAlpha3)
//<img src=`data:image/png;base64, ${flag}`/>
You can search and find any country's data by any parameter, like-
name
: You can search and find data by country namecountryCode
: You can search and find data by country codecallingCode
: You can search and find data by country calling codecurrencyName
: You can search and find data by country currency namecurrencyCode
: You can search and find data by country currency codecurrencySymbol
: You can search and find data by country currency symbolisoNumeric
: You can search and find data by country iso numericExample
import { lookup, CountryDataTypes } from "country-data-codes";
const data: CountryDataTypes = lookup({name: "Bangladesh"})
const data: CountryDataTypes = lookup({countryCode: "BD"})
const data: CountryDataTypes = lookup({callingCode: "+880"})
const data: CountryDataTypes = lookup({currencyName: "taka"})
const data: CountryDataTypes = lookup({currencyCode: "BDT"})
const data: CountryDataTypes = lookup({currencySymbol: "৳"})
You can remove dial code from a phone number and get a string value.
Example
import { removeDialCode } from "country-data-codes";
const phone = removeDialCode("+8801611994404")
//undefined or
//01611994403
If you face any issues to any function or see any wrong information about country, please let me know.
country-data-codes MIT licensed.
FAQs
A simple react phone input component with calling code dropdown🤷
We found that react-simple-phone-input demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.