portsInTier関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The places of a tier and the tiers above it, in the list's order.
インポート
import { portsInTier } from "@johnmorrisdotca/chizu";
定義
function portsInTier(ports: readonly ChizuPort[], tier: 1 | 2 | 3): ChizuPort[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
ports | readonly ChizuPort[] | The places to choose from. |
tier | 1 | 2 | 3 | The last tier kept. |
戻り値
ChizuPort[]
The places whose tier is at most tier.
例
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(" "));
// aa出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。