Skip to the content

Chizu地図

Draw SVG maps of the world, its 253 countries and the regions of 33 of them, frame them, place numbered callouts and build geography quizzes, with names in English and Japanese today (Spanish, German and Chinese are planned).

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

Contents

Reference · Framing, geometry and quiz tools

portsInTierfunction

The places of a tier and the tiers above it, in the list's order.

Import it

import { portsInTier } from "@johnmorrisdotca/chizu";

Definition

function portsInTier(ports: readonly ChizuPort[], tier: 1 | 2 | 3): ChizuPort[]

Parameters

NameTypeDescription
portsreadonly ChizuPort[]

The places to choose from.

tier1 | 2 | 3

The last tier kept.

Returns

ChizuPort[]

The places whose tier is at most tier.

Examples

import { portsInTier, type ChizuPort } from "@johnmorrisdotca/chizu";

const make = (id: string, tier: 1 | 2 | 3): ChizuPort => ({ id, kind: "harbour", name: { en: id }, country: "JP", lat: 35, lon: 139, tier });
console.log(portsInTier([make("a", 1), make("b", 3)], 2).map((port) => port.id).join(" "));
// a
a

What it prints (run when this page was built)

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