replaceCard関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A hand with one card tossed out and another given in its stead, at the front or the end: as a new list. Unchanged where it holds no such card.
インポート
import { replaceCard } from "@johnmorrisdotca/toranpu/element";
ほかのエクスポート元: @johnmorrisdotca/toranpu/element/define
定義
function replaceCard(cards: readonly string[], card: string, next: string, lands?: CardLands): string[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
cards | readonly string[] | The cards in their current order. |
card | string | The physical card or card id to read, draw or play. |
next | string | The replacement card or next state. |
lands (省略可) | CardLands | Where a replacement card is placed in the hand. |
戻り値
string[]
A hand with one card tossed out and another given in its stead, at the front or the end: as a new list. Unchanged where it holds no such card.
例
import { replaceCard } from "@johnmorrisdotca/toranpu/element";
console.log(replaceCard(["AS", "KH"], "AS", "2D"));[ 'KH', '2D' ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。