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 · Country facts

factsfunction

The facts about one country, by its alpha-2 code in either case.

Import it

import { facts } from "@johnmorrisdotca/kuni/facts";

Definition

function facts(code: string): CountryFacts | null

Parameters

NameTypeDescription
codestring

An ISO 3166-1 alpha-2 code, "JP" or "jp"; for an alpha-3 or numeric code, pass country(code)?.alpha2.

Returns

CountryFacts | null

The country's facts, frozen; null for anything that is not one of the 250 codes.

Examples

import { facts } from "@johnmorrisdotca/kuni/facts";

console.log(facts("JP")?.population);    // 123802000
console.log(facts("JP")?.populationYear); // 2024
console.log(facts("FR")?.borders);        // ["AD", "BE", "BR", "CH", "DE", "ES", "IT", "LU", "MC", "SR"]
console.log(facts("GB")?.drivingSide);    // "left"
console.log(facts("US")?.weekStart);      // "sun"
console.log(facts("XX"));                 // null
123802000
2024
[
  'AD', 'BE', 'BR',
  'CH', 'DE', 'ES',
  'IT', 'LU', 'MC',
  'SR'
]
left
sun
null

What it prints (run when this page was built)

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