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
| Name | Type | Description |
|---|---|---|
ports | readonly ChizuPort[] | The places to choose from. |
tier | 1 | 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(" "));
// aaWhat it prints (run when this page was built)