countriesFromText関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The countries a pasted list names, by English name, Japanese name, short Japanese name, reading or code, in the order written
(placesFromText): countriesFromText("Japan, フランス\nBrazil").
インポート
import { countriesFromText } from "@johnmorrisdotca/chizu/names";
定義
function countriesFromText(text: string): { countries: ChizuCountry[]; missing: string[]; }
引数
| 名前 | 型 | 説明 |
|---|---|---|
text | string | Pasted names or serialized attribute text specified by this signature. |
戻り値
{ countries: ChizuCountry[]; missing: string[]; }
The countries a pasted list names, by English name, Japanese name, short Japanese name, reading or code, in the order written (placesFromText): countriesFromText("Japan, フランス\nBrazil").
例
import { countriesFromText } from "@johnmorrisdotca/chizu/names";
const found = countriesFromText("Japan, ドイツ\nUS, Narnia");
console.log(found.countries.map((country) => country.code), found.missing);
// [ 'JP', 'DE', 'US' ] [ 'Narnia' ][ 'JP', 'DE', 'US' ] [ 'Narnia' ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。