rankingRanks関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The ranks of a list, in order: an entry's own rank, else its position, with equal points sharing a rank; null for a champion row. Pure; takes the list as it is ordered.
インポート
import { rankingRanks } from "@johnmorrisdotca/taisen-brackets";
定義
function rankingRanks(entries: readonly RankingEntry[], options?: { ties?: boolean; }): (number | null)[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
entries | readonly RankingEntry[] | The entries, in the order they are listed. |
options (省略可) | { ties?: boolean; } |
|
戻り値
(number | null)[]
The ranks, one for each entry; null for an entry that has no points.
例
import { rankingRanks } from "@johnmorrisdotca/taisen-brackets";
const entries = Array.from({ length: 6 }, (_, i) => ({ name: `Athlete ${i + 1}`, points: 100 - Math.floor(i / 2) * 3 }));
console.log(rankingRanks(entries).join(" "));1 1 3 3 5 5出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。