Names型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
One language's names: what an entry @johnmorrisdotca/kuni/names/<language> exports. Every function is pure.
インポート
import type { Names } from "@johnmorrisdotca/kuni/names/fr";
ほかのエクスポート元: @johnmorrisdotca/kuni/names/es, @johnmorrisdotca/kuni/names/de, @johnmorrisdotca/kuni/names/zh-Hans, @johnmorrisdotca/kuni/names/zh-Hant, @johnmorrisdotca/kuni/names/ko, @johnmorrisdotca/kuni/names/pt, @johnmorrisdotca/kuni/names/ar, @johnmorrisdotca/kuni/names/ru
定義
interface Names {
readonly language: NamesLanguage;
countryName(code: string, options?: NamesNameOptions): string | null;
countryVariants(code: string): readonly string[];
countryByName(text: string): CountryCode | null;
countries(options?: NamesListOptions): readonly NamedCountry[];
fold(text: string): string;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
language | NamesLanguage | The language of this entry. |
countryName | (code: string, options?: NamesNameOptions): string | null | A country's name in this language, as |
countryVariants | (code: string): readonly string[] | The variant forms CLDR gives for a country in this language; empty for most and for a code that is not a country. |
countryByName | (text: string): CountryCode | null | The country somebody typed, by name, short form, variant or alias in this language (or its alpha-2 code), as |
countries | (options?: NamesListOptions): readonly NamedCountry[] | All 250 countries with their names in this language, in the order asked. |
fold | (text: string): string | What two ways of typing a name have in common in this language, as |
例
import type { Names } from "@johnmorrisdotca/kuni/names/fr";
const read = (names: Names): string | null => names.countryName("JP");
console.log(typeof read); // "function"function出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。