nationid - v2.2.1
    Preparing search index...

    Function listCountries

    • Lists every supported country with localized names and flag emojis.

      Ordering is stable across patch releases — countries are returned in the order they were added to the library (matches v0.1 → v0.4 → v0.6 waves), not alphabetically. UIs that want alphabetical sorting can sort the result by name in their locale.

      Parameters

      • locale: string = DEFAULT_LOCALE

        Any BCP 47 language tag (default "en").

      Returns readonly CountryInfo[]

      Read-only array of CountryInfo, one per supported country.

      import { listCountries } from "nationid/catalog";

      listCountries("es");
      // [
      // { code: "SV", alpha3: "SLV", name: "El Salvador", flag: "🇸🇻" },
      // { code: "MX", alpha3: "MEX", name: "México", flag: "🇲🇽" },
      // …
      // ]

      // Alphabetical:
      listCountries("es").toSorted((a, b) => a.name.localeCompare(b.name, "es"));