Reference · Cards, hands and piles
tossCardfunction
A hand without one card, as a new list: the first of that card taken out, or the hand unchanged where it holds none.
Import it
import { tossCard } from "@johnmorrisdotca/toranpu/element";
Also exported from: @johnmorrisdotca/toranpu/element/define
Definition
function tossCard(cards: readonly string[], card: string): string[]
Parameters
| Name | Type | Description |
|---|---|---|
cards | readonly string[] | The cards in their current order. |
card | string | The physical card or card id to read, draw or play. |
Returns
string[]
A hand without one card, as a new list: the first of that card taken out, or the hand unchanged where it holds none.
Examples
import { tossCard } from "@johnmorrisdotca/toranpu/element";
console.log(tossCard(["AS", "KH"], "AS"));[ 'KH' ]What it prints (run when this page was built)