Skip to the content

Chizu地図

Draw SVG maps, frame regions, place numbered callouts and build geography quizzes with English and Japanese names.

Chizu is the Japanese word 地図 for map. About the name

Contents

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

NameTypeDescription
textstring

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chizu 1.5.0.