{"id":24618044,"url":"https://github.com/kculz/country_utils","last_synced_at":"2025-05-07T06:02:25.607Z","repository":{"id":243640998,"uuid":"812781681","full_name":"kculz/country_utils","owner":"kculz","description":"A utility class for working with country data, including country codes, phone country codes, and more.","archived":false,"fork":false,"pushed_at":"2024-06-16T17:50:21.000Z","size":7,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-28T20:17:50.147Z","etag":null,"topics":["alpha-2-country-code","country-codes","expressjs","iso-codes","nodejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@greycode/country_utils","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kculz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-09T21:25:03.000Z","updated_at":"2024-06-16T17:50:24.000Z","dependencies_parsed_at":"2024-06-10T11:32:49.090Z","dependency_job_id":"bf123beb-09bd-4c27-8add-86d41a76ab23","html_url":"https://github.com/kculz/country_utils","commit_stats":null,"previous_names":["kculz/country_utils"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kculz%2Fcountry_utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kculz%2Fcountry_utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kculz%2Fcountry_utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kculz%2Fcountry_utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kculz","download_url":"https://codeload.github.com/kculz/country_utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252823910,"owners_count":21809711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["alpha-2-country-code","country-codes","expressjs","iso-codes","nodejs"],"created_at":"2025-01-24T23:49:36.249Z","updated_at":"2025-05-07T06:02:25.539Z","avatar_url":"https://github.com/kculz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CountryUtil\n\nA utility class for working with country data, including country codes, phone country codes, and more. This package provides a convenient way to access and work with country-related information in your JavaScript projects.\n\n## Features\n\n- Get a country's name, alpha-2 code, and numeric code\n- Look up a country by phone country code or ISO code\n- Retrieve a list of all countries with their respective data\n- Easily integrate country data into your applications\n\n## Installation\n\nTo install the `CountryUtil` package, run the following command in your project's directory:\n```\n$ npm install @greycode/country_utils\n```\n## Usage\n\nHere's an example of how to use the `CountryUtil` class in your project:\n\n```javascript\nconst CountryUtil = require('@greycode/country_utils');\n\nconst countryUtil = new CountryUtil();\n\n// Get a country's information using phone code (eg. +1)\nconst country = countryUtil.getByPhoneCode('+1');\nconsole.log(country); // Output: { isValid: true, country: 'United States', countryCode: 'US', phoneCode: '+1' }\n\n// Get a country's information using country alpha-2 code (eg. US)\nconst country = countryUtil.getByCountryCode('US');\nconsole.log(country); // Output: { isValid: true, country: 'United States', countryCode: 'US', phoneCode: '+1' }\n\n// Get a country's information using country name (eg. United States)\nconst country = countryUtil.getByCountry('United States');\nconsole.log(country); // Output: { isValid: true, country: 'United States', countryCode: 'US', phoneCode: '+1' }\n\n// Get a list of all countries\nconst allCountries = countryUtil.getAllCountries();\nconsole.log(allCountries);\n```\n\n## API\nThe CountryUtil class provides the following methods:\n\n`getByPhoneCode(phoneCode: string)`: Returns the country information for the given phone country code (eg +263).\n\n`getByCountryCode(isoCode: string)`: Returns the country information for the given ISO code (alpha-2 eg ZW).\n\n`getByCountry(phoneCode: string)`: Looks up a country information by  country name (eg Zimbabwe). \n\n`getAllCountries()`: Returns an array of all countries with their respective data.\n\n\n\n## Contributing\nIf you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the [GitHub repository](https://github.com/kculz/country_utils.git).\n\n### License\nThis project is licensed under the `MIT` License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkculz%2Fcountry_utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkculz%2Fcountry_utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkculz%2Fcountry_utils/lists"}