{"id":18487074,"url":"https://github.com/michaelwittig/node-i18n-iso-countries","last_synced_at":"2026-02-22T15:02:00.263Z","repository":{"id":12606978,"uuid":"15277988","full_name":"michaelwittig/node-i18n-iso-countries","owner":"michaelwittig","description":"i18n for ISO 3166-1 country codes","archived":false,"fork":false,"pushed_at":"2025-02-17T18:47:40.000Z","size":1024,"stargazers_count":882,"open_issues_count":54,"forks_count":266,"subscribers_count":12,"default_branch":"master","last_synced_at":"2026-01-30T14:56:05.564Z","etag":null,"topics":["hacktoberfest","hacktoberfest2020"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelwittig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"supportedLocales.json","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-12-18T08:38:41.000Z","updated_at":"2026-01-18T16:00:44.000Z","dependencies_parsed_at":"2022-06-29T14:32:24.578Z","dependency_job_id":"bf898cb9-ac63-434e-bb50-844f3f3738bd","html_url":"https://github.com/michaelwittig/node-i18n-iso-countries","commit_stats":{"total_commits":337,"total_committers":148,"mean_commits":2.277027027027027,"dds":0.7863501483679525,"last_synced_commit":"c07acc61b10fd44f0a461197b66b92ef7ecd2ed4"},"previous_names":["cinovo/node-i18n-iso-countries"],"tags_count":105,"template":false,"template_full_name":null,"purl":"pkg:github/michaelwittig/node-i18n-iso-countries","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwittig%2Fnode-i18n-iso-countries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwittig%2Fnode-i18n-iso-countries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwittig%2Fnode-i18n-iso-countries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwittig%2Fnode-i18n-iso-countries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelwittig","download_url":"https://codeload.github.com/michaelwittig/node-i18n-iso-countries/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwittig%2Fnode-i18n-iso-countries/sbom","scorecard":{"id":283803,"data":{"date":"2025-08-11","repo":{"name":"github.com/michaelwittig/node-i18n-iso-countries","commit":"55c3a72603faf0185661e80841074e1c2fcf8db5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":5,"reason":"Found 16/29 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/michaelwittig/node-i18n-iso-countries/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/michaelwittig/node-i18n-iso-countries/ci.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"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"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T16:41:38.611Z","repository_id":12606978,"created_at":"2025-08-17T16:41:38.612Z","updated_at":"2025-08-17T16:41:38.612Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29716528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T13:30:57.152Z","status":"ssl_error","status_checked_at":"2026-02-22T13:30:28.561Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","hacktoberfest2020"],"created_at":"2024-11-06T12:50:11.660Z","updated_at":"2026-02-22T15:01:59.936Z","avatar_url":"https://github.com/michaelwittig.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# i18n-iso-countries\n\ni18n for ISO 3166-1 country codes. We support Alpha-2, Alpha-3 and Numeric codes from ['Wikipedia: Officially assigned code elements'][iso:3166-1]\n\n## Installing\n\nInstall it using npm: `npm install i18n-iso-countries`\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n```\n\nIf you use `i18n-iso-countries` with Node.js, you are done. If you use the package in a browser environment, you have to register the languages you want to use to minimize the file size.\n\n```javascript\n// Support french \u0026 english languages.\ncountries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\ncountries.registerLocale(require(\"i18n-iso-countries/langs/fr.json\"));\n```\n\n## Code to Country\n\n### Get the name of a country by its ISO 3166-1 Alpha-2, Alpha-3 or Numeric code\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(\"US (Alpha-2) =\u003e \" + countries.getName(\"US\", \"en\")); // United States of America\nconsole.log(\"US (Alpha-2) =\u003e \" + countries.getName(\"US\", \"de\")); // Vereinigte Staaten von Amerika\nconsole.log(\"USA (Alpha-3) =\u003e \" + countries.getName(\"USA\", \"en\")); // United States of America\nconsole.log(\"USA (Numeric) =\u003e \" + countries.getName(\"840\", \"en\")); // United States of America\n```\n\n#### Get aliases/short name using select\n\n```javascript\n// Some countries have alias/short names defined. `select` is used to control which\n// name will be returned.\nconsole.log(\"GB (select: official) =\u003e \" + countries.getName(\"GB\", \"en\", {select: \"official\"})); // United Kingdom\nconsole.log(\"GB (select: alias) =\u003e \" + countries.getName(\"GB\", \"en\", {select: \"alias\"})); // UK\nconsole.log(\"GB (select: all) =\u003e \" + countries.getName(\"GB\", \"en\", {select: \"all\"})); // [\"United Kingdom\", \"UK\", \"Great Britain\"]\n// Countries without an alias will always return the offical name\nconsole.log(\"LT (select: official) =\u003e \" + countries.getName(\"LT\", \"en\", {select: \"official\"})); // Lithuania\nconsole.log(\"LT (select: alias) =\u003e \" + countries.getName(\"LT\", \"en\", {select: \"alias\"})); // Lithuania\nconsole.log(\"LT (select: all) =\u003e \" + countries.getName(\"LT\", \"en\", {select: \"all\"})); // [\"Lithuania\"]\n```\n\n### Get all names by their ISO 3166-1 Alpha-2 code\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(countries.getNames(\"en\", {select: \"official\"})); // { 'AF': 'Afghanistan', 'AL': 'Albania', [...], 'ZM': 'Zambia', 'ZW': 'Zimbabwe' }\n```\n\n### Supported languages (ISO 639-1)\n\n\u003e In case you want to add new language, please refer [ISO 639-1 table][iso:639-1].\n\n- `af`: Afrikaans\n- `am`: Amharic\n- `ar`: Arabic\n- `az`: Azerbaijani\n- `be`: Belorussian\n- `bg`: Bulgarian\n- `bn`: Bengali\n- `br`: Breton\n- `bs`: Bosnian\n- `ca`: Catalan\n- `cs`: Czech\n- `cy`: Cymraeg\n- `da`: Danish\n- `de`: German\n- `dv`: Dhivehi\n- `en`: English\n- `es`: Spanish\n- `et`: Estonian\n- `eu`: Basque\n- `fa`: Persian\n- `fi`: Finnish\n- `fr`: French\n- `ga`: Irish\n- `gl`: Galician\n- `el`: Greek\n- `ha`: Hausa\n- `he`: Hebrew\n- `hi`: Hindi\n- `hr`: Croatian\n- `hu`: Hungarian\n- `hy`: Armenian\n- `is`: Icelandic\n- `it`: Italian\n- `id`: Indonesian\n- `ja`: Japanese\n- `ka`: Georgian\n- `kk`: Kazakh\n- `km`: Khmer\n- `ko`: Korean\n- `ku`: Kurdish\n- `ky`: Kyrgyz\n- `lt`: Lithuanian\n- `lv`: Latvian\n- `mk`: Macedonian\n- `ml`: Malayalam\n- `mn`: Mongolian\n- `mr`: Marathi\n- `ms`: Malay\n- `mt`: Maltese\n- `nb`: Norwegian Bokmål\n- `nl`: Dutch\n- `nn`: Norwegian Nynorsk\n- `no`: Norwegian\n- `pl`: Polish\n- `ps`: Pashto\n- `pt`: Portuguese\n- `ro`: Romanian\n- `ru`: Russian\n- `sd`: Sindhi\n- `sk`: Slovak\n- `sl`: Slovene\n- `so`: Somali\n- `sq`: Albanian\n- `sr`: Serbian\n- `sv`: Swedish\n- `sw`: Swahili\n- `ta`: Tamil\n- `tg`: Tajik\n- `th`: Thai\n- `tk`: Turkmen\n- `tr`: Turkish\n- `tt`: Tatar\n- `ug`: Uyghur\n- `uk`: Ukrainian\n- `ur`: Urdu\n- `uz`: Uzbek\n- `zh`: Chinese\n- `vi`: Vietnamese\n\n[List of ISO 639-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)\n\n### Get all supported languages (ISO 639-1)\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\nconsole.log(\"List of supported languages =\u003e \" + countries.getSupportedLanguages());\n// List of supported languages =\u003e [\"cy\", \"dv\", \"sw\", \"eu\", \"af\", \"am\", ...]\n```\n\n### Country to Code\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(\"United States of America =\u003e \" + countries.getAlpha2Code(\"United States of America\", \"en\"));\n// United States of America =\u003e US\n\nconsole.log(\"United States of America =\u003e \" + countries.getAlpha3Code(\"United States of America\", \"en\"));\n// United States of America =\u003e USA\n```\n\n## Codes\n\n### Convert Alpha-3 to Alpha-2 code\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(\"USA (Alpha-3) =\u003e \" + countries.alpha3ToAlpha2(\"USA\") + \" (Alpha-2)\");\n// USA (Alpha-3) =\u003e US (Alpha-2)\n```\n\n### Convert Numeric to Alpha-2 code\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(\"840 (Numeric) =\u003e \" + countries.numericToAlpha2(\"840\") + \" (Alpha-2)\");\n// 840 (Numeric) =\u003e US (Alpha-2)\n```\n\n### Convert Alpha-2 to Alpha-3 code\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(\"DE (Alpha-2) =\u003e \" + countries.alpha2ToAlpha3(\"DE\") + \" (Alpha-3)\");\n// DE (Alpha-2) =\u003e DEU (Alpha-3)\n```\n\n### Convert Numeric to Alpha-3 code\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(\"840 (Numeric) =\u003e \" + countries.numericToAlpha3(\"840\") + \" (Alpha-3)\");\n// 840 (Numeric) =\u003e USA (Alpha-3)\n```\n\n### Convert Alpha-3 to Numeric code\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(countries.alpha3ToNumeric(\"SWE\"));\n// 752\n```\n\n### Convert Alpha-2 to Numeric code\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(countries.alpha2ToNumeric(\"SE\"));\n// 752\n```\n\n### Get all Alpha-2 codes\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(countries.getAlpha2Codes());\n// { 'AF': 'AFG', 'AX': 'ALA', [...], 'ZM': 'ZMB', 'ZW': 'ZWE' }\n```\n\n### Get all Alpha-3 codes\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(countries.getAlpha3Codes());\n// { 'AFG': 'AF', 'ALA': 'AX', [...], 'ZMB': 'ZM', 'ZWE': 'ZW' }\n```\n\n### Get all Numeric codes\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(countries.getNumericCodes());\n// { '004': 'AF', '008': 'AL', [...], '887': 'YE', '894': 'ZM' }\n```\n\n### Validate country code\n\n```javascript\nvar countries = require(\"i18n-iso-countries\");\n// in a browser environment: countries.registerLocale(require(\"i18n-iso-countries/langs/en.json\"));\nconsole.log(\n  countries.isValid(\"US\"),\n  countries.isValid(\"USA\"),\n  countries.isValid(\"XX\")\n);\n// true, true, false\n```\n\n## Contribution\n\nTo add a language:\n\n- add a json file under [langs/](langs)\n- add the language to the list in supportedLocales.json at the top\n- add language to section **Supported languages** in [README.md](#supported-languages-iso-639-1)\n- add language to keywords in [package.json](package.json)\n- run `npm run lint` and `npm test`\n- open a PR on GitHub\n\nYou can check codes here: https://www.iso.org/obp/ui/#home\n\n[iso:639-1]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\n[iso:3166-1]: http://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwittig%2Fnode-i18n-iso-countries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelwittig%2Fnode-i18n-iso-countries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwittig%2Fnode-i18n-iso-countries/lists"}