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

sortPresidentfunction

Cards in President's order, lowest first, suits in a fixed order only so a hand always sorts the same way.

Import it

import { sortPresident } from "@johnmorrisdotca/toranpu/president";

Definition

function sortPresident(cards: readonly CardId[]): CardId[]

Parameters

NameTypeDescription
cardsreadonly string[]

The cards in their current order.

Returns

string[]

Cards in President's order, lowest first, suits in a fixed order only so a hand always sorts the same way.

Examples

import { sortPresident } from "@johnmorrisdotca/toranpu/president";

console.log(sortPresident(["2S", "3D", "AC"]));
[ '3D', 'AC', '2S' ]

What it prints (run when this page was built)

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