cardIdfunction
"QS", "TH", "AC": the two-character id card players write, rank then suit,
with T for the ten. For a game that keys its state by a readable id; a
kept deal is written with cardCode, one character a card.
Import it
import { cardId } from "@johnmorrisdotca/toranpu/deck";
Definition
function cardId(card: Card): string
Parameters
| Name | Type | Description |
|---|---|---|
card | Card | The physical card or card id to read, draw or play. |
Returns
string
"QS", "TH", "AC": the two-character id card players write, rank then suit, with T for the ten. For a game that keys its state by a readable id; a kept deal is written with cardCode, one character a card.
Examples
import { cardId } from "@johnmorrisdotca/toranpu/deck";
const card = { suit: "spades", rank: 1 } as const;
console.log(cardId(card));ASWhat it prints (run when this page was built)