Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

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

NameTypeDescription
cardsreadonly string[]

The cards in their current order.

cardstring

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.