facts関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The facts about one country, by its alpha-2 code in either case.
インポート
import { facts } from "@johnmorrisdotca/kuni/facts";
定義
function facts(code: string): CountryFacts | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
code | string | An ISO 3166-1 alpha-2 code, "JP" or "jp"; for an alpha-3 or numeric code, pass |
戻り値
CountryFacts | null
The country's facts, frozen; null for anything that is not one of the 250 codes.
例
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
null出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。