Reference · Country names and groups
countriesFromTextfunction
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 it
import { countriesFromText } from "@johnmorrisdotca/chizu/names";
Definition
function countriesFromText(text: string): { countries: ChizuCountry[]; missing: string[]; }
Parameters
| Name | Type | Description |
|---|---|---|
text | string | Pasted names or serialized attribute text specified by this signature. |
Returns
{ 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").
Examples
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' ]What it prints (run when this page was built)