groupMap関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The map cut down to a group: the same canvas, only the regions whose codes are given (in the map's order), only their boxes, and neighbours only among themselves. What a quiz or a callout sheet within the group is given, so that "which country of Africa is this?" offers African look-alikes and numbers African countries only. Codes the map does not have are passed over.
インポート
import { groupMap } from "@johnmorrisdotca/chizu";
定義
function groupMap(map: ChizuMap, codes: ReadonlyArray<string | number>, names?: { id?: string; name?: string; nameJa?: string; }): ChizuMap
引数
| 名前 | 型 | 説明 |
|---|---|---|
map | ChizuMap | The native map or map fields required by this signature; coordinates and region codes belong to its canvas. |
codes | readonly (string | number)[] | Native region codes from this map, in the requested order. |
names (省略可) | { id?: string; name?: string; nameJa?: string; } | Optional names for the resulting group map. |
戻り値
ChizuMap
The map cut down to a group: the same canvas, only the regions whose codes are given (in the map's order), only their boxes, and neighbours only among themselves. What a quiz or a callout sheet within the group is given, so that "which country of Africa is this?" offers African look-alikes and numbers African countries only. Codes the map does not have are passed over.
例
import WORLD from "@johnmorrisdotca/chizu/world";
import { CHIZU_CONTINENTS } from "@johnmorrisdotca/chizu/names";
import { findQuestion, groupMap, seededRandom } from "@johnmorrisdotca/chizu";
const africa = CHIZU_CONTINENTS.find((continent) => continent.code === "AF")!;
const map = groupMap(WORLD, africa.codes, { name: africa.name, nameJa: africa.nameJa });
console.log(map.regions.length, findQuestion(map, "KE", seededRandom(1))?.choices.length);
// 50 450 4出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。