Reference · Framing, geometry and quiz tools
regionGroupsfunction
The groups a map's regions fall in, by their group, in the order the map first names them: the continents on the
world, the eight regions on Japan's prefectures, the four Census regions on the United States'.
Import it
import { regionGroups } from "@johnmorrisdotca/chizu";
Definition
function regionGroups(map: Pick<ChizuMap, "regions">): ChizuGroup[]
Parameters
| Name | Type | Description |
|---|---|---|
map | Pick<ChizuMap, "regions"> | The native map or map fields required by this signature; coordinates and region codes belong to its canvas. |
Returns
ChizuGroup[]
The groups a map's regions fall in, by their group, in the order the map first names them: the continents on the world, the eight regions on Japan's prefectures, the four Census regions on the United States'.
Examples
import WORLD from "@johnmorrisdotca/chizu/world";
import { regionGroups } from "@johnmorrisdotca/chizu";
const groups = regionGroups(WORLD);
console.log(groups.map((group) => `${group.name} ${group.codes.length}`).join(", "));
// Asia 46, Europe 39, Africa 50, North America 18, South America 13, Oceania 7Asia 46, Europe 39, Africa 50, North America 18, South America 13, Oceania 7What it prints (run when this page was built)