{"id":31920991,"url":"https://github.com/babajidemm/african-countries-api","last_synced_at":"2026-03-17T22:16:26.063Z","repository":{"id":42730640,"uuid":"281782232","full_name":"babajidemm/african-countries-api","owner":"babajidemm","description":"A Node.js library that provides APIs to get useful data about African countries including their cities (with more than 500 inhabitants).","archived":false,"fork":false,"pushed_at":"2023-01-06T12:53:17.000Z","size":2676,"stargazers_count":2,"open_issues_count":11,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-04T10:52:34.636Z","etag":null,"topics":["african-cities","african-cities-500","african-countries","african-countries-with-cities","api","countries","countries-api","module","nodejs","nodejs-library","nodejs-modules"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@babajidemm/african-countries-api","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/babajidemm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-22T21:00:34.000Z","updated_at":"2024-10-25T18:45:20.000Z","dependencies_parsed_at":"2023-02-06T03:16:18.502Z","dependency_job_id":null,"html_url":"https://github.com/babajidemm/african-countries-api","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/babajidemm/african-countries-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babajidemm%2Fafrican-countries-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babajidemm%2Fafrican-countries-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babajidemm%2Fafrican-countries-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babajidemm%2Fafrican-countries-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/babajidemm","download_url":"https://codeload.github.com/babajidemm/african-countries-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babajidemm%2Fafrican-countries-api/sbom","scorecard":{"id":222277,"data":{"date":"2025-08-11","repo":{"name":"github.com/babajidemm/african-countries-api","commit":"b39f7a5b300305446c0570f7d820716ea0c40ee1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","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":"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":"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/npm-publish.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":"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/npm-publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/babajidemm/african-countries-api/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/babajidemm/african-countries-api/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/babajidemm/african-countries-api/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/babajidemm/african-countries-api/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/babajidemm/african-countries-api/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/babajidemm/african-countries-api/npm-publish.yml/master?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   3 out of   3 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":"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":"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":"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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":"Vulnerabilities","score":0,"reason":"24 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"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-17T02:52:06.615Z","repository_id":42730640,"created_at":"2025-08-17T02:52:06.615Z","updated_at":"2025-08-17T02:52:06.615Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30633243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"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":["african-cities","african-cities-500","african-countries","african-countries-with-cities","api","countries","countries-api","module","nodejs","nodejs-library","nodejs-modules"],"created_at":"2025-10-13T22:17:52.914Z","updated_at":"2026-03-17T22:16:26.054Z","avatar_url":"https://github.com/babajidemm.png","language":"JavaScript","readme":"# African Countries API\n\nA Node.js library for querying African country data (including cities with more than 500 inhabitants) from a local bundled dataset.\n\nIt is useful when you want country lookup features without managing your own country JSON files.\n\n## Who is this for?\n\n- **Developers** who need country metadata (name, region, languages, codes, borders, phone codes, etc.) in backend or tooling scripts.\n- **Non-dev users** who want quick copy-paste examples and simple command-line usage with Node.js.\n\n## Install\n\n```sh\nnpm i @babajidemm/african-countries-api\n```\n\nRequires Node.js (LTS recommended).\n\n## Quick Start (Developer)\n\n```js\nconst api = require('@babajidemm/african-countries-api');\n\nconst result = api.byName('Algeria');\n\nif (result.statusCode === 200) {\n  const countries = JSON.parse(result.body.toString());\n  console.log(countries[0].cca2); // DZ\n}\n```\n\n## Quick Start (Non-Developer / CLI)\n\nAfter installing in a folder, run:\n\n```sh\nnode -e \"const api=require('@babajidemm/african-countries-api'); const r=api.byCapital('Accra'); console.log(r.statusCode); console.log(r.body.toString());\"\n```\n\nThis prints status code and the matching JSON array.\n\n## Response Format\n\nEvery method returns an `http-response-object` style response:\n\n- `statusCode` (number)\n- `headers` (object)\n- `body` (Buffer for success/not-found responses)\n- `url` (undefined)\n\nTypical status codes:\n\n- `200` → found result(s)\n- `404` → no matches\n- `400` → invalid input shape for methods that require strict input (example: `byCoordinates` with non-array input)\n\n## API Methods\n\n| Method | Description | Example Input |\n|---|---|---|\n| `all()` | Return all African countries | none |\n| `byName(name)` | Match common or official country name | `'Algeria'` |\n| `byCountryCode(code)` | Match CCA2 code | `'DZ'` |\n| `byISOAlpha3CountryCode(code)` | Match CCA3 code | `'DZA'` |\n| `byISONumericCountryCode(code)` | Match numeric country code | `'012'` |\n| `byOlympicCommiteeCode(cioc)` | Match IOC code | `'ALG'` |\n| `byCurrency(currency)` | Match currency symbol/code | `'DZD'` |\n| `byBorder(border)` | Match neighboring country code | `'TUN'` |\n| `byLanguage(language)` | Match language value (not key) | `'Arabic'` |\n| `byLatitude(lat)` | Match latitude | `28` |\n| `byLongitude(lng)` | Match longitude | `3` |\n| `byCoordinates([lat, lng])` | Match exact coordinate pair | `[28, 3]` |\n| `byCapital(capital)` | Match capital city | `'Algiers'` |\n| `byPhoneCode(phoneCode)` | Match calling code | `'213'`, `'+213'`, `213` |\n| `byRegion(region)` | Match region | `'Africa'` |\n| `bySubregion(subregion)` | Match subregion | `'Northern Africa'` |\n| `byDemonym(demonym)` | Match demonym | `'Algerian'` |\n| `byAlternativeName(altName)` | Match alternative spellings | `'Dzayer'`, `'Algérie'` |\n| `byTopLevelDomain(tld)` | Match TLD | `'dz'` or `'.dz'` |\n\n## Input Notes \u0026 Edge Cases\n\n- Most string lookups are case-sensitive.\n- `byPhoneCode` normalizes `+` signs and numeric-like values (for example `'+213'`, `'0213'`, and `213` resolve correctly).\n- `byCoordinates` requires an array; non-array input returns `400`.\n- `byTopLevelDomain` accepts either `'dz'` or `'.dz'` and normalizes to dot-prefixed format internally.\n\n## Local Development\n\n```sh\nnpm install\nnpm test\n```\n\nCoverage report command:\n\n```sh\nnpm run coverage\n```\n\n## Data Source\n\n- Cities data: [geonames.org](http://www.geonames.org/)\n- Country data origin reference: [restcountries.eu/rest/v2/all](https://restcountries.eu/rest/v2/all)\n\nDataset note: the bundled data snapshot was last updated in **July 2020**.\n\n## Deno\n\nAlso available on Deno:\nhttps://deno.land/x/africancountriesapi@1.1.4\n\n## Contributing\n\n- Contributors: https://github.com/babajidemm/african-countries-api/graphs/contributors\n- Contribution guide: [CONTRIBUTING](./CONTRIBUTING.md)\n\n## License\n\nMIT. See [LICENSE](./LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabajidemm%2Fafrican-countries-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbabajidemm%2Fafrican-countries-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabajidemm%2Fafrican-countries-api/lists"}