cardFromCodefunction
The card a character names, or null for one that names none — a kept string is read, never trusted.
Import it
import { cardFromCode } from "@johnmorrisdotca/toranpu/deck";
Definition
function cardFromCode(code: string): Card | null
Parameters
| Name | Type | Description |
|---|---|---|
code | string | The encoded card or game state. |
Returns
Card | null
The card a character names, or null for one that names none — a kept string is read, never trusted.
Examples
import { cardCode, cardFromCode } from "@johnmorrisdotca/toranpu/deck";
const card = { suit: "spades", rank: 1 } as const;
console.log(cardFromCode(cardCode(card)));{ suit: 'spades', rank: 1 }What it prints (run when this page was built)