Countries, Languages & Continents data (capital and currency, native name, calling codes).
Installations
npm install countries-list
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Node Version
20.14.0
NPM Version
10.7.0
Releases
Improve `getCountryCode()`
Published on 31 Jul 2024
Update data & types (new `partOf`, `userAssigned` params for countries)
Published on 04 Mar 2024
v3.0.6
Published on 20 Oct 2023
v3.0.5
Published on 29 Sept 2023
v3.0.1
Published on 29 Sept 2023
v3.0: ESM, TypeScript, Turborepo and country data updates
Published on 12 Sept 2023
Contributors
Unable to fetch Contributors
Languages
TypeScript (97.75%)
PHP (2.17%)
Shell (0.07%)
Developer
Download Statistics
Total Downloads
30,113,807
Last Day
45,353
Last Week
196,346
Last Month
822,081
Last Year
10,029,402
GitHub Statistics
1,211 Stars
206 Commits
432 Forks
18 Watching
2 Branches
14 Contributors
Bundle Size
42.24 kB
Minified
13.81 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.1.1
Package Id
countries-list@3.1.1
Unpacked Size
265.64 kB
Size
82.49 kB
File Count
24
NPM Version
10.7.0
Node Version
20.14.0
Publised On
31 Jul 2024
Total Downloads
Cumulative downloads
Total Downloads
30,113,807
Last day
6.6%
45,353
Compared to previous day
Last week
-9.3%
196,346
Compared to previous week
Last month
12.2%
822,081
Compared to previous month
Last year
42.5%
10,029,402
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
No dependencies detected.
Countries, Languages & Continents data
Continents & countries: ISO 3166-1 alpha-2 code (with alpha-2 to alpha-3 set), name, ISO 639-1 languages, capital and ISO 4217 currency codes, native name, calling codes. Lists are available in JSON, CSV and SQL formats. Also, contains separate JSON files with additional country Emoji flags data.
Version 3.0: Breaking changes
Version 3 comes with some data structure changes. It was completely reworked under the hood with TypeScript, ESM exports and Turborepo file structure.
Everything is strongly typed so you can easily use data with auto-complete in your IDE.
Note: If your projects depend on the old structure, carefully specify required versions in your dependencies.
Installation
Package is available via:
- NPM
npm install countries-list
- Composer / Packagist
composer require annexare/countries-list
Usage (version 3.x)
Module exports continents
, countries
, languages
and utility functions.
1// Interfaces and types 2import type { 3 ICountry, 4 ICountryData, 5 ILanguage, 6 TContinentCode, 7 TCountryCode, 8 TLanguageCode, 9} from 'countries-list' 10 11// Main data and utils 12import { continents, countries, languages } from 'countries-list' 13// Utils 14import { getCountryCode, getCountryData, getCountryDataList, getEmojiFlag } from 'countries-list' 15 16// Minimal data in JSON 17import countries2to3 from 'countries-list/minimal/countries.2to3.min.json' 18import countries3to2 from 'countries-list/minimal/countries.3to2.min.json' 19import languageNames from 'countries-list/minimal/languages.native.min' 20 21getCountryCode('Ukraine') // 'UA' 22getCountryCode('Україна') // 'UA' 23getCountryData('UA') // ICountryData
Built files are in the dist
directory of this repository, and packages/countries
directory contains source data.
Note: JS build contains ES modules, CommonJS and IIFE (for now)
- CJS
cjs/index.js
- ESM
mjs/index.js
- IIFE
index.iife.js
Data structure examples
1const continents = { 2 AF: 'Africa', 3 AN: 'Antarctica', 4 AS: 'Asia', 5 EU: 'Europe', 6 NA: 'North America', 7 OC: 'Oceania', 8 SA: 'South America', 9} 10 11const countries = { 12 // ... 13 UA: { 14 name: 'Ukraine', 15 native: 'Україна', 16 phone: [380], 17 continent: 'EU', 18 capital: 'Kyiv', 19 currency: ['UAH'], 20 languages: ['uk'], 21 }, 22 // ... 23} 24 25const languages = { 26 // ... 27 uk: { 28 name: 'Ukrainian', 29 native: 'Українська', 30 }, 31 ur: { 32 name: 'Urdu', 33 native: 'اردو', 34 rtl: 1, 35 }, 36 // ... 37}
Contributing to this repository
Everything is generated from strongly typed files in packages/countries/src
, including SQL file.
Everything in dist
is generated,
so please make data related changes ONLY to files from packages/countries
, commit them.
Use npm run build
(or turbo build
, turbo test
) command to build/test generated files.
Credits
Prepared by Annexare Studio from different public sources. Feel free to use it as you need in your apps or send updates into this public repository. It's under MIT license.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
3 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/annexare/Countries/nodejs.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/annexare/Countries/nodejs.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/phpunit.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/annexare/Countries/phpunit.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/phpunit.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/annexare/Countries/phpunit.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/phpunit.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/annexare/Countries/phpunit.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:36
- Info: 0 out of 3 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 third-party GitHubAction dependencies pinned
- Info: 1 out of 2 npmCommand dependencies pinned
Reason
Found 2/29 approved changesets -- score normalized to 0
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1
- Warn: no topLevel permission defined: .github/workflows/phpunit.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 8 are checked with a SAST tool
Score
3.6
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to countries-list
world-countries
List of world countries in JSON, CSV, XML and Yaml
country-list
Maps ISO 3166-1-alpha-2 codes to English country names and vice versa.
countries-list-as-georgian
Countries list with flags ( English/Georgian )
homeoffice-countries
Exports a list of countries that can, for example, be used with Typeahead Aria