{"id":13736489,"url":"https://github.com/kraptor/isocodes","last_synced_at":"2025-05-08T12:32:57.427Z","repository":{"id":161499148,"uuid":"384556659","full_name":"kraptor/isocodes","owner":"kraptor","description":"ISO codes for Nim. Supports loading the data at runtime or embedding it within the executable.","archived":false,"fork":false,"pushed_at":"2024-11-07T21:12:05.000Z","size":1245,"stargazers_count":13,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-07T22:19:16.165Z","etag":null,"topics":["countries","currency","iso","language","languages","nim","nim-lang","scripts","standards"],"latest_commit_sha":null,"homepage":"","language":"Nim","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/kraptor.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":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-09T21:42:33.000Z","updated_at":"2024-11-07T21:12:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"cd7804ae-a8a6-43fd-8ac7-11c9d0c0a13b","html_url":"https://github.com/kraptor/isocodes","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kraptor%2Fisocodes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kraptor%2Fisocodes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kraptor%2Fisocodes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kraptor%2Fisocodes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kraptor","download_url":"https://codeload.github.com/kraptor/isocodes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224732129,"owners_count":17360416,"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":["countries","currency","iso","language","languages","nim","nim-lang","scripts","standards"],"created_at":"2024-08-03T03:01:22.768Z","updated_at":"2025-05-08T12:32:57.413Z","avatar_url":"https://github.com/kraptor.png","language":"Nim","funding_links":[],"categories":["Data"],"sub_categories":["Standards"],"readme":"\u003c!--\n Copyright (c) 2021 kraptor\n \n This software is released under the MIT License.\n https://opensource.org/licenses/MIT\n--\u003e\n\n[![made-with-nim](https://img.shields.io/badge/Made%20with-Nim-ffc200.svg)](https://nim-lang.org/) ![Build](https://github.com/kraptor/isocodes/workflows/Build/badge.svg)\n\n# `isocodes`\n\nISO codes for Nim.\n\nSupports loading the data at runtime or embedding it within the executable\n\nProvides the utility `isocodes_download` to download latest JSON packages when\nyou don't want to use the provided ones (or if they become obsolete).\n\nBy default all data is embedded within the executable. See section [Compilation flags](#compilation-flags) on how to specify the files to load/embed and  how to\nload the data at runtime if you need to.\n\n## Supported ISO standards\n\n| ISO | Description | Library type |\n|-|-|-|\n| ISO 3166-1 | Name of countries                    | `Country`           |\n| ISO 3166-2 | Country subdivisions                 | `CountrySubdivision`|\n| ISO 3166-3 | Countries removed from the standard. | `RemovedCountry`    |\n| ISO 15924  | Language scripts                     | `Script`            |\n| ISO 4217   | Currencies                           | `Currency`          |\n| ISO 639-2  | Languages                            | `Language`          |\n| ISO 639-5  | Language Families                    | `LanguageFamily`    |\n\n## Example\n\n```nim\n    import isocodes\n\n    if isMainModule:\n        for c in Country.allIt():\n            echo c.name\n```\n\n## API\n\nAll procedures/iterators can be accessed by using the corresponding type.\nFor example: `Country`.\n\nProcedures either return an `Option[T]` object or a `seq[T]` (when multiple\nvalues can be requested).\n\n\u003e **IMPORTANT**: Procedures ending in `It` return an iterator, instead of a\n`seq[T]`, if you don't want to store/build a copy of the data requested.\n\n### Country API\n\n#### Country Attributes\n\nThe following attributes are available for each `Country` instance:\n\n| Attribute | Description |\n|-|-|\n|`name`         | Country name.                   |\n|`official_name`| Official name of the country.   |\n|`common_name`  | Common name for the country.    |\n|`alpha_2`      | Country ISO code (2 characters).|\n|`alpha_3`      | Country ISO code (3 characters).|\n|`numeric`      | Numeric code for the country. **NOTE**: this is a string. |\n|`flag`         | Flag emoji for the country. |\n\n#### Country Procedures\n\n| Procedure | Description |\n|-|-|\n|`.count()`            | Number of countries                                      |\n|`.all()`              | `seq` for all countries.                                 |\n|`.allIt()`            | Iterator for all countries.                              |\n|`.byName(str)`        | `Option[Country]` with the specified name.               |\n|`.byAlpha2(str)`      | `Option[Country]` with the specified alpha2 code.        |\n|`.byAlpha3(str)`      | `Option[Country]` with the specified alpha3 code.        |\n|`.byNumeric(str)`     | `Option[Country]` with the specified numeric code.       |\n|`.byOfficialName(str)`| `Option[Country]` with the specified official name.      |\n|`.byCommonName(str)`  | `Option[Country]` with the specified common name.        |\n|`.find(proc)`         | `seq` for all countries that proc evaluates to `true`.   |\n|`.findIt(proc)`       | Iterator for all countries that proc evaluates to `true`.|\n|`.findFirst(proc)`    | `Option[Country]` were proc evaluates to `true`.         |\n\n### CountrySubdivision API\n\n#### CountrySubdivision Attributes\n\n| Attribute | Description |\n|-|-|\n|`code`   | Subdivision code.               |\n|`name`   | Name of the subdivision.        |\n|`type`   | Type of the subdivision.\u003cbr /\u003e**NOTE**: use [stropping](https://en.wikipedia.org/wiki/Nim_%28programming_language%29#Stropping) to access this field because type is a reserved word.\u003cbr /\u003eExample: ``echo subdivision.`type` ``.|\n|`parent` | Parent code.|\n\n#### CountrySubdivision Procedures\n\n| Procedure | Description |\n|-|-|\n|`.count()`             | Number of subdivisions                                      |\n|`.all()`               | `seq` for all subdivisions.                                 |\n|`.allIt()`             | Iterator for all subdivisions.                              |\n|`.byCountryCode(str)`  | `seq` for subdivisions for an specific country code.        |\n|`.byCountryCodeIt(str)`| Iterator for subdivisions for an specific country code.     |\n|`.byCode(str)`         | `seq` for subdivisions by specified code.                   |\n|`.byCodeIt(str)`       | Iterator for subdivisions specified by code.                |\n|`.byCodeStart(str)`    | `seq` for subdivisions where code starts by a value.        |\n|`.byCodeStartIt(str)`  | Iterator subdivisions where code starts by a value.         |\n|`.byName(str)`         | `seq` for subdivisions with specified name.                 |\n|`.byNameIt(str)`       | Iterator for subdivisions with specified name.              |\n|`.byType(str)`         | `seq` for subdivisions with the specified type.             |\n|`.byTypeIt(str)`       | Iterator for subdivisions with the specified type.          |\n|`.byParent(str)`       | `seq` for subdivisions with the specified parent value.     |\n|`.byParentIt(str)`     | Iterator for subdivisions with the specified parent value.  |\n|`.find(proc)`          | `seq` for all subdivisions that proc evaluates to `true`.   |\n|`.findIt(proc)`        | Iterator for all subdivisions that proc evaluates to `true`.|\n|`.findFirst(proc)`     | `Option[CountrySubdivision]` were proc evaluates to `true`. |\n\n### RemovedCountry API\n\n#### RemovedCountry Attributes\n\n| Attribute | Description |\n|-|-|\n|`name`           | Country name.                    |\n|`official_name`  | Official name of the country.    |\n|`alpha_2`        | Country ISO code (2 characters). |\n|`alpha_3`        | Country ISO code (3 characters). |\n|`alpha_4`        | Country ISO code (4 characters). |\n|`numeric`        | Numeric code for the country. \u003cbr/\u003e **NOTE**: this is a string.|\n|`comment`        | Comment about the country.       |\n|`withdrawal_date`| Date of withdrawal (format: YYYY or YYYY-MM-DD) \u003cbr/\u003e **NOTE**: this is a string.|\n\n#### RemovedCountry Procedures\n\n| Procedure | Description |\n|-|-|\n|`.count()`                | Number of countries                                      |\n|`.all()`                  | `seq` for all countries.                                 |\n|`.allIt()`                | Iterator for all countries.                              |\n|`.byName(str)`            | `Option[Country]` with the specified name.               |\n|`.byAlpha2(str)`          | `Option[Country]` with the specified alpha2 code.        |\n|`.byAlpha3(str)`          | `Option[Country]` with the specified alpha3 code.        |\n|`.byAlpha4(str)`          | `Option[Country]` with the specified alpha4 code.        |\n|`.byNumeric(str)`         | `Option[Country]` with the specified numeric code.       |\n|`.byWithdrawalDate(str)`  | `seq` for all countries with specified date.             |\n|`.byWithdrawalDateIt(str)`| Iterator all countries with specified date.              |\n|`.byWithdrawalYear(str)`  | `seq` for all countries with specified year.             |\n|`.byWithdrawalYearIt(str)`| Iterator all countries with specified year.              |\n|`.find(proc)`             | `seq` for all countries that proc evaluates to `true`.   |\n|`.findIt(proc)`           | Iterator for all countries that proc evaluates to `true`.|\n|`.findFirst(proc)`        | `Option[Country]` were proc evaluates to `true`.         |\n\n### Script API\n\n#### Script Attributes\n\n| Attribute | Description |\n|-|-|\n|`name`           | Script name.                    |\n|`alpha_4`        | Script ISO code (4 characters). |\n|`numeric`        | Numeric code for the script. \u003cbr/\u003e **NOTE**: this is a string.|\n\n#### Script Procedures\n\n| Procedure | Description |\n|-|-|\n|`.count()`        | Number of scripts                                       |\n|`.all()`          | `seq` for all scripts.                                  |\n|`.allIt()`        | Iterator for all scripts.                               |\n|`.byName(str)`    | `Option[Script]` with the specified name.               |\n|`.byAlpha4(str)`  | `Option[Script]` with the specified alpha4 code.        |\n|`.byNumeric(str)` | `Option[Script]` with the specified numeric code.       |\n|`.find(proc)`     | `seq` for all scripts that proc evaluates to `true`.    |\n|`.findIt(proc)`   | Iterator for all scripts that proc evaluates to `true`. |\n|`.findFirst(proc)`| `Option[Script]` were proc evaluates to `true`.         |\n\n### Currency API\n\n#### Currency Attributes\n\n| Attribute | Description |\n|-|-|\n|`name`           | Currency name.                    |\n|`alpha_3`        | Currency ISO code (3 characters). |\n|`numeric`        | Numeric code for the currency. \u003cbr/\u003e **NOTE**: this is a string.|\n\n#### Currency Procedures\n\n| Procedure | Description |\n|-|-|\n|`.count()`        | Number of currencies.                                     |\n|`.all()`          | `seq` for all currencies.                                 |\n|`.allIt()`        | Iterator for all currencies.                              |\n|`.byName(str)`    | `Option[Currency]` with the specified name.               |\n|`.byAlpha3(str)`  | `Option[Currency]` with the specified alpha3 code.        |\n|`.byNumeric(str)` | `Option[Currency]` with the specified numeric code.       |\n|`.find(proc)`     | `seq` for all currencies that proc evaluates to `true`.   |\n|`.findIt(proc)`   | Iterator for all currencies that proc evaluates to `true`.|\n|`.findFirst(proc)`| `Option[Currency]` were proc evaluates to `true`.         |\n\n### Language API\n\n#### Language Attributes\n\n| Attribute | Description |\n|-|-|\n|`name`           | Language name.                    |\n|`alpha_2`        | Language ISO code (2 characters). |\n|`alpha_3`        | Language ISO code (3 characters). |\n|`common_name`    | Language common name.             |\n|`bibliographic`  | Language bibliographic code.      |\n\n#### Language Procedures\n\n| Procedure | Description |\n|-|-|\n|`.count()`             | Number of languages.                                     |\n|`.all()`               | `seq` for all languages.                                 |\n|`.allIt()`             | Iterator for all languages.                              |\n|`.byName(str)`         | `Option[Language]` with the specified name.              |\n|`.byCommonName(str)`   | `Option[Language]` with the specified common name.       |\n|`.byAlpha2(str)`       | `Option[Language]` with the specified alpha2 code.       |\n|`.byAlpha3(str)`       | `Option[Language]` with the specified alpha3 code.       |\n|`.byBibliographic(str)`| `Option[Language]` with the specified bibliographic code.|\n|`.find(proc)`          | `seq` for all languages that proc evaluates to `true`.   |\n|`.findIt(proc)`        | Iterator for all languages that proc evaluates to `true`.|\n|`.findFirst(proc)`     | `Option[Language]` were proc evaluates to `true`.        |\n\n### LanguageFamily API\n\n#### LanguageFamily Attributes\n\n| Attribute | Description |\n|-|-|\n|`name`           | Language family name.                    |\n|`alpha_3`        | Language family ISO code (3 characters). |\n\n#### LanguageFamily Procedures\n\n| Procedure | Description |\n|-|-|\n|`.count()`             | Number of language families.                                     |\n|`.all()`               | `seq` for all language families.                                 |\n|`.allIt()`             | Iterator for all language families.                              |\n|`.byName(str)`         | `Option[LanguageFamily]` with the specified name.                |\n|`.byAlpha3(str)`       | `Option[LanguageFamily]` with the specified alpha3 code.         |\n|`.find(proc)`          | `seq` for all language families that proc evaluates to `true`.   |\n|`.findIt(proc)`        | Iterator for all language families that proc evaluates to `true`.|\n|`.findFirst(proc)`     | `Option[LanguageFamily]` were proc evaluates to `true`.          |\n\n## Compilation flags\n\nWith the following flags it's possible to embed the data (or not) and specify the JSON\nfile to embed/load. This could be useful if the provided files are outdated and you want\nto provide your own files, or if you want to load the data at runtime.\n\n| Flag | Comment |\n|-|-|\n| **Countries**\n|`-d:embedCountries=true`         | Embed countries data within the executable.        |\n|`-d:embedCountries=false`        | Load countries data at runtime.                    |\n|`-d:useCountriesFile=PATH`       | Use a specific countries JSON file.                |\n| **Country Subdivisions**\n|`-d:embedSubdivisions=true`      | Embed subdivisions data within the executable.     |\n|`-d:embedSubdivisions=false`     | Load subdivisions data at runtime.                 |\n|`-d:useSubdivisionsFile=PATH`    | Use a specific subdivisions JSON file.             |\n| **Removed Countries**\n|`-d:embedRemovedCountries=true`  | Embed removed countries data within the executable.|\n|`-d:embedRemovedCountries=false` | Load removed countries data at runtime.            |\n|`-d:useRemovedCountriesFile=PATH`| Use a specific removed countries JSON file.        |\n| **Scripts**\n|`-d:embedScripts=true`  | Embed scripts data within the executable.|\n|`-d:embedScripts=false` | Load scripts data at runtime.            |\n|`-d:useScriptsFile=PATH`| Use a specific scripts JSON file.        |\n| **Currencies**\n|`-d:embedCurrencies=true`  | Embed currencies data within the executable.|\n|`-d:embedCurrencies=false` | Load currencies data at runtime.            |\n|`-d:useCurrenciesFile=PATH`| Use a specific currencies JSON file.        |\n| **Language**\n|`-d:embedLanguages=true`  | Embed languages data within the executable.|\n|`-d:embedLanguages=false` | Load languages data at runtime.            |\n|`-d:useLanguagesFile=PATH`| Use a specific languages JSON file.        |\n| **Language Families**\n|`-d:embedLanguageFamilies=true`  | Embed language families data within the executable.|\n|`-d:embedLanguageFamilies=false` | Load language families data at runtime.            |\n|`-d:useLanguageFamiliesFile=PATH`| Use a specific language families JSON file.        |\n\n## Source\n\nThe ISO codes JSON files are synced verbatim from Debian's `iso-codes`\nrepository here:\n\n- \u003chttps://salsa.debian.org/iso-codes-team/iso-codes/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkraptor%2Fisocodes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkraptor%2Fisocodes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkraptor%2Fisocodes/lists"}