 [](https://jsr.io/@praveen/countries-codes-enar) [](h
npm install countries-codes-enar!Package Size


TypeScript friendly country data (English and Arabic) with powerful search utilities.
---
* π Full list of 249 countries
* π¬π§ English name, πΈπ¦ Arabic name, ISO codes (ISO2 & ISO3), and country calling codes
* π Fast, type-safe search functions
* π§βπ» Ready for Node.js, Bun, Deno, and browser via CDN
---
``bashnpm
npm install countries-codes-enar
---
π Usage
`ts
import {
COUNTRIES_DATA,
getByIsoCode2,
getByCountryCode,
getByCountryName,
getByCountryArabicName,
searchByCountryName,
searchByCountryArabicName,
searchCountryData
} from 'countries-codes-enar';// Example: Get country by ISO 2 code
const india = getByIsoCode2('IN');
console.log(india);
// Example: Get country by country calling code
const usa = getByCountryCode('1');
console.log(usa);
// Example: Get country by English name
const egypt = getByCountryName('Egypt');
console.log(egypt);
// Example: Get country by Arabic name
const saudi = getByCountryArabicName('Ψ§ΩΩ
Ω
ΩΩΨ© Ψ§ΩΨΉΨ±Ψ¨ΩΨ© Ψ§ΩΨ³ΨΉΩΨ―ΩΨ©');
console.log(saudi);
// Example: Search by partial English name
const searchResults = searchByCountryName('Uni');
console.log(searchResults);
// Example: Search by partial Arabic name
const searchArabic = searchByCountryArabicName('Ψ§ΩΩ
');
console.log(searchArabic);
// Example: Search by any name or code
const generalSearch = searchCountryData('SA');
console.log(generalSearch);
`---
ποΈ API Reference
| Function | Description |
| --------------------------------- | ---------------------------------------- |
|
COUNTRIES_DATA | Full array of all country data |
| getByIsoCode2(code2) | Get country by ISO 2 code |
| getByCountryCode(code) | Get country by calling code |
| getByCountryName(name) | Get country by exact English name |
| getByCountryArabicName(name) | Get country by exact Arabic name |
| searchByCountryName(name) | Search countries by partial English name |
| searchByCountryArabicName(name) | Search countries by partial Arabic name |
| searchCountryData(nameOrCode) | Search by any name, Arabic name, or code |---
β¨ Example Country Object
`ts
{
country: "India",
isoCode2: "IN",
isoCode3: "IND",
arabicName: "Ψ§ΩΩΩΨ―",
countryCodes: ["91"]
}
``---
MIT