A tiny, zero-dependency dataset and utilities for ISO-3166 country codes (alpha-2/alpha-3/numeric) and names. Lookup by code or name, validate inputs, and map between formats—fast and tree-shakeable.
npm install @siamf/iso3166

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 codes
- name The currency name
- symbol The currency symbol
* 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.
``bash`
$ npm i @siamf/iso3166`bash`
import { getCountryList } from "@siamf/iso3166";
or
const { getCountryList } = require("@siamf/iso3166")
Example
`bash`
console.log(getCountryList()); //Returns all country list
Example
`bash
import { getCurrency, GetCurrencyTypes } from "@siamf/iso3166";
const currencyInfo: GetCurrencyTypes = getCurrency("BD"); // Here country code can be isoAlpha2 or isoAlpha3
console.log(currencyInfo)
`name
Return values-
* currency namecode
* currency codesymbol
* currency symbol
Example
`bash
import { getCallingCode, GetCallingCodeTypes } from "@siamf/iso3166";
const dialingCode: GetCallingCodeTypes = getCallingCode("BD")
console.log(dialingCode) // Give the country code(isoAlpha2 or isoAlpha3)
//{
code: "880",
format: "+880",
flag: "" //Flagmedia flag URL
}
`$3
Returns the country's languages. It returns an array of string;
Example
`bash
import { getLanguages } from "@siamf/iso3166";
console.log(getLanguages("BD")) // Give the country code(isoAlpha2 or isoAlpha3)
//["ben"]
`
Example
`bash
import { getFlagBase64 } from "@siamf/iso3166";
const flag = getFlagBase64("BD") // Give the country code(isoAlpha2 or isoAlpha3)
//data:image/png;base64, ${flag}
/>`
: You can search and find data by country name
* by countryCode: You can search and find data by country code
* by callingCode: You can search and find data by country calling code
* by currencyName: You can search and find data by country currency name
* by currencyCode: You can search and find data by country currency code
* by currencySymbol: You can search and find data by country currency symbol
* by isoNumeric: You can search and find data by country iso numericExample
`bash
import { lookup, CountryDataTypes } from "@siamf/iso3166";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: "৳"})
`$3
You can remove dial code from a phone number and get a string value.Example
`bash
import { removeDialCode } from "@siamf/iso3166";const phone = removeDialCode("+8801611994404")
//undefined or
//01611994403
``