iridium

The International Standard for country codes and codes for their subdivisions on Nim (ISO-3166)

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install iridium
choosenim install iridium
git clone https://github.com/KingDarBoja/Iridium

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
iridium - - - - - - -

Source

Repository https://github.com/KingDarBoja/Iridium
Homepage https://github.com/KingDarBoja/Iridium
Registry Source nimble_official

README

Iridium

The International Standard for country codes and codes for their subdivisions on Nim (ISO-3166).

GitHub issues GitHub stars

Usage

>>> import iridium
>>> echo getCountryByCode("CO")
(name: "Colombia", alpha2: "CO", alpha3: "COL", numeric: "170", official: "Republic of Colombia")
>>> echo getSubdivisionByCode("CO-QUI")
(name: "Quindío", category: "Department", parent: "")

Install

nimble install iridium

Requisites

Documentation

Types

The country data is stored as a CountryDivision object with the following fields:

type
  CountryDivision* = object
    name*: string       ## Country name (short)
    alpha2*: string     ## Two letter alphabetic code of the country
    alpha3*: string     ## Three letter alphabetic code of the country
    numeric*: string    ## Three digit numeric code of the country, including leading zeros
    official*: string   ## Official name of the country (optional)

The country subdivision is stored as a CountrySubdivision object with the following fields:

type
  CountrySubdivision* = object
    name*: string        ## Name of the country subdivision
    category*: string    ## Type of subdivision of the country (i.e. Province, Region, Emirate)
    parent*: string      ## Parent of the country subdivision

Procedures

Each procedure will raise a KeyError if the code does not satisfy certain checks (i.e. code does not exist, invalid numeric code).

ISO-3166-1 Related

  • getAllCountries()

Get all the countries data as a Nim Table whose keys are the country alpha2 code and the values as CountryDivision object.

  • Arguments: None
  • Returns: Table[string, CountryDivision]

  • getCountryByCode()

Get the country data by its alpha2 code.

  • Arguments:
    • code ISO-3166-1 alpha2 code, required.
  • Returns: CountryDivision

  • getCountryByName()

Get the country data by its name.

  • Arguments:
    • countryName The common name, required.
  • Returns: CountryDivision

  • getCountryByAlpha3()

Get the country data by its alpha3 code.

  • Arguments:
    • alpha3Code ISO-3166-1 alpha3 code, required.
  • Returns: CountryDivision

  • getCountryByNumeric()

Get the country data by its numeric code.

  • Arguments:
    • numericCode ISO-3166-1 numeric code as string or integer, required.
  • Returns: CountryDivision

ISO-3166-2 Related

  • getAllSubdivisions()

Get all the subdivisions data as a Nim Table whose keys are the subdivision code (country-subdivision) and the values as CountrySubdivision object.

  • Arguments: None
  • Returns: Table[string, CountrySubdivision]

  • getSubdivisionsByCountry()

Get the country subdivisions data by its code as a sequence.

  • Arguments:
    • countryCode ISO-3166-1 alpha2 country code as string, required.
  • Returns: seq[CountrySubdivision]

  • getSubdivisionByCode()

Get the subdivision data by its code.

  • Arguments:
    • numericCode ISO-3166-2 code as string, required.
  • Returns: CountrySubdivision

ISO-4217 Related

  • getAllCurrencies()

Get all the currencies as a Nim table whose keys are the currency alphabetic code and the values as CurrencyCode object.

  • Arguments: None
  • Returns: Table[string, CurrencyCode]

  • getCurrencyByCode()

Get the currency data by its alphabetic code.

  • Arguments:
    • code ISO-4217 alphabetic code as string, required.
  • Returns: CurrencyCode