Skip to the content

Kuni国

Look up countries, codes, names and subdivisions, load country data on demand and mount a native country card.

Kuni (国) is Japanese for a country. About the name

Contents

Reference · Places: countries of a continent, and search (the size counts every tier)

countriesOffunction

The countries of a continent, from kuni's groupings (the seven continents), in alpha-2 order.

Import it

import { countriesOf } from "@johnmorrisdotca/kuni/places";

Definition

function countriesOf(continent: string): readonly Country[]

Parameters

NameTypeDescription
continentstring

"AF", "AN", "AS", "EU", "NA", "OC" or "SA", in either case.

Returns

readonly Country[]

The countries, frozen; an empty list for a code that is not a continent.

Examples

import { countriesOf } from "@johnmorrisdotca/kuni/places";

console.log(countriesOf("OC").map((one) => one.alpha2).includes("AU")); // true
console.log(countriesOf("eu").some((one) => one.alpha2 === "FR"));       // true
console.log(countriesOf("XX").length);                                   // 0
true
true
0

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kuni 1.19.0.