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 · Deck tools

cardIndexfunction

The card's place in a fresh deck, 0 to 51.

Import it

import { cardIndex } from "@johnmorrisdotca/toranpu/deck";

Definition

function cardIndex(card: Card): number

Parameters

NameTypeDescription
cardCard

The physical card or card id to read, draw or play.

Returns

number

The card's place in a fresh deck, 0 to 51.

Examples

import { cardIndex } from "@johnmorrisdotca/toranpu/deck";

const card = { suit: "spades", rank: 1 } as const;
console.log(cardIndex(card));
0

What it prints (run when this page was built)

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