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 · Hearts

sortHeartsfunction

A hand sorted as a player holds it: clubs, diamonds, spades, hearts, low to high within each.

Import it

import { sortHearts } from "@johnmorrisdotca/toranpu/hearts";

Definition

function sortHearts(hand: readonly CardId[]): CardId[]

Parameters

NameTypeDescription
handreadonly string[]

The player’s held cards, or the hand number for a deal.

Returns

string[]

A hand sorted as a player holds it: clubs, diamonds, spades, hearts, low to high within each.

Examples

import { sortHearts } from "@johnmorrisdotca/toranpu/hearts";

console.log(sortHearts(["QS", "2C", "AH"]));
[ '2C', 'QS', 'AH' ]

What it prints (run when this page was built)

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