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
| Name | Type | Description |
|---|---|---|
code | string | An ISO 3166-1 alpha-2 code, "JP" or "jp"; for an alpha-3 or numeric code, pass |
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")); // null123802000
2024
[
'AD', 'BE', 'BR',
'CH', 'DE', 'ES',
'IT', 'LU', 'MC',
'SR'
]
left
sun
nullWhat it prints (run when this page was built)